1--TEST--
2json_validate() - compare against json_decode() for different types of inputs
3--FILE--
4<?php
5
6$inputs = [
7    '""',
8    '"string"',
9    '1234',
10    '123.45',
11    '-123',
12    'null',
13    'true',
14    'false',
15    '{}',
16    '[]',
17    '-',
18    '',
19];
20
21foreach ($inputs as $input) {
22    var_dump($input, json_decode($input), json_validate($input));
23}
24
25?>
26--EXPECTF--
27string(2) """"
28string(0) ""
29bool(true)
30string(8) ""string""
31string(6) "string"
32bool(true)
33string(4) "1234"
34int(1234)
35bool(true)
36string(6) "123.45"
37float(123.45)
38bool(true)
39string(4) "-123"
40int(-123)
41bool(true)
42string(4) "null"
43NULL
44bool(true)
45string(4) "true"
46bool(true)
47bool(true)
48string(5) "false"
49bool(false)
50bool(true)
51string(2) "{}"
52object(stdClass)#1 (0) {
53}
54bool(true)
55string(2) "[]"
56array(0) {
57}
58bool(true)
59string(1) "-"
60NULL
61bool(false)
62string(0) ""
63NULL
64bool(false)
65