Home
last modified time | relevance | path

Searched refs:json_encode (Results 1 – 25 of 81) sorted by relevance

1234

/PHP-8.1/ext/json/tests/
H A D002.phpt2 json_encode() tests
6 var_dump(json_encode(""));
7 var_dump(json_encode(NULL));
8 var_dump(json_encode(TRUE));
10 var_dump(json_encode(array(""=>"")));
11 var_dump(json_encode(array(array(1))));
12 var_dump(json_encode(array()));
14 var_dump(json_encode(array(""=>""), JSON_FORCE_OBJECT));
16 var_dump(json_encode(array(), JSON_FORCE_OBJECT));
18 var_dump(json_encode(1));
[all …]
H A Dbug50224.phpt2 bug #50224 (json_encode() does not always encode a float as a float)
8 var_dump(json_encode(12.3, JSON_PRESERVE_ZERO_FRACTION));
9 var_dump(json_encode(12, JSON_PRESERVE_ZERO_FRACTION));
10 var_dump(json_encode(12.0, JSON_PRESERVE_ZERO_FRACTION));
11 var_dump(json_encode(0.0, JSON_PRESERVE_ZERO_FRACTION));
12 var_dump(json_encode(array(12, 12.0, 12.3), JSON_PRESERVE_ZERO_FRACTION));
17 var_dump(json_decode(json_encode(12.3, JSON_PRESERVE_ZERO_FRACTION)));
18 var_dump(json_decode(json_encode(12, JSON_PRESERVE_ZERO_FRACTION)));
19 var_dump(json_decode(json_encode(12.0, JSON_PRESERVE_ZERO_FRACTION)));
20 var_dump(json_decode(json_encode(0.0, JSON_PRESERVE_ZERO_FRACTION)));
[all …]
H A Djson_encode_u2028_u2029.phpt2 json_encode() tests for U+2028, U+2029
5 var_dump(json_encode(array("a\xC3\xA1b")));
6 var_dump(json_encode(array("a\xC3\xA1b"), JSON_UNESCAPED_UNICODE));
7 var_dump(json_encode("a\xE2\x80\xA7b"));
8 var_dump(json_encode("a\xE2\x80\xA7b", JSON_UNESCAPED_UNICODE));
9 var_dump(json_encode("a\xE2\x80\xA8b"));
10 var_dump(json_encode("a\xE2\x80\xA8b", JSON_UNESCAPED_UNICODE));
13 var_dump(json_encode("a\xE2\x80\xA9b"));
14 var_dump(json_encode("a\xE2\x80\xA9b", JSON_UNESCAPED_UNICODE));
17 var_dump(json_encode("a\xE2\x80\xAAb"));
[all …]
H A Djson_encode_numeric.phpt2 Test json_encode() function with numeric flag
8 json_encode("1", JSON_NUMERIC_CHECK),
9 json_encode("9.4324", JSON_NUMERIC_CHECK),
10 json_encode(array("122321", "3232595.33423"), JSON_NUMERIC_CHECK),
11 json_encode("1"),
12 json_encode("9.4324"),
13 json_encode(array("122321", "3232595.33423"))
H A Djson_encode_pretty_print2.phpt2 json_encode() with JSON_PRETTY_PRINT on declared properties
16 echo json_encode(new HasNoProperties()), "\n";
17 echo json_encode(new HasNoProperties(), JSON_PRETTY_PRINT), "\n";
19 echo json_encode(new MyClass()), "\n";
20 echo json_encode(new MyClass(), JSON_PRETTY_PRINT), "\n";
23 echo json_encode($obj), "\n";
24 echo json_encode($obj, JSON_PRETTY_PRINT), "\n";
27 echo json_encode($obj), "\n";
28 echo json_encode($obj, JSON_PRETTY_PRINT), "\n";
30 echo json_encode($obj), "\n";
[all …]
H A Dbug73254.phpt2 Bug #73254 (Incorrect indentation generated by json_encode() with JSON_PRETTY_PRINT)
6 echo json_encode([json_encode([1], JSON_PRETTY_PRINT)]), "\n";
10 echo json_encode($data), "\n";
11 echo json_encode([json_encode([1], JSON_PRETTY_PRINT)]), "\n";
H A Dbug81532.phpt2 Bug #81532: Change of $depth behaviour in json_encode() on PHP 8.1
17 var_export(json_encode($a, 0, 0)); echo "\n";
18 var_export(json_encode($a, 0, 1)); echo "\n";
19 var_export(json_encode($b, 0, 1)); echo "\n";
20 var_export(json_encode($b, 0, 2)); echo "\n";
21 var_export(json_encode($c, 0, 2)); echo "\n";
22 var_export(json_encode($c, 0, 3)); echo "\n";
H A D006.phpt2 json_encode() & extended encoding
7 echo "Normal: ", json_encode($a), "\n";
8 echo "Tags: ", json_encode($a, JSON_HEX_TAG), "\n";
9 echo "Apos: ", json_encode($a, JSON_HEX_APOS), "\n";
10 echo "Quot: ", json_encode($a, JSON_HEX_QUOT), "\n";
11 echo "Amp: ", json_encode($a, JSON_HEX_AMP), "\n";
12 echo "All: ", json_encode($a, JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP), "\n";
H A Djson_encode_invalid_utf8.phpt2 json_encode() invalid UTF8
6 var_dump(json_encode($str));
7 var_dump(json_encode($str, JSON_INVALID_UTF8_IGNORE));
8 var_dump(json_encode($str, JSON_INVALID_UTF8_SUBSTITUTE));
9 var_dump(json_encode($str, JSON_UNESCAPED_UNICODE));
10 var_dump(bin2hex(json_encode($str, JSON_UNESCAPED_UNICODE | JSON_INVALID_UTF8_SUBSTITUTE)));
H A Dbug43941.phpt2 Bug #43941 (json_encode() invalid UTF-8)
6 var_dump(json_encode("abc"));
7 var_dump(json_encode("ab\xE0"));
8 var_dump(json_encode("ab\xE0", JSON_PARTIAL_OUTPUT_ON_ERROR));
9 var_dump(json_encode(array("ab\xE0", "ab\xE0c", "abc"), JSON_PARTIAL_OUTPUT_ON_ERROR));
H A Dbug53946.phpt2 bug #53946 (json_encode() with JSON_UNESCAPED_UNICODE)
5 var_dump(json_encode("latin 1234 -/ russian мама мыла раму specialchars \x02 \x08 \n U+1D11…
6 var_dump(json_encode("latin 1234 -/ russian мама мыла раму specialchars \x02 \x08 \n U+1D11…
7 var_dump(json_encode("ab\xE0"));
8 var_dump(json_encode("ab\xE0", JSON_UNESCAPED_UNICODE));
H A Dbug61537.phpt2 Bug #61537 (json_encode() incorrectly truncates/discards information)
7 var_dump(json_encode($invalid_utf8));
10 var_dump(json_encode($invalid_utf8, JSON_PARTIAL_OUTPUT_ON_ERROR));
17 var_dump(json_encode($invalid_utf8));
20 var_dump(json_encode($invalid_utf8, JSON_PARTIAL_OUTPUT_ON_ERROR));
H A Dbug72069.phpt2 Bug #72069 (Behavior \JsonSerializable different from json_encode)
6 $result = json_encode(['end' => json_decode('', true)]);
18 $result = json_encode($a);
21 $result = json_encode($toJsonData);
H A Djson_encode_basic_utf8.phpt2 Test json_encode() function : basic functionality with UTF8 string input
5 echo "*** Testing json_encode() : basic functionality with UTF-8 input***\n";
8 var_dump(json_encode($utf8_string));
12 *** Testing json_encode() : basic functionality with UTF-8 input***
H A Dbug42090.phpt10 json_encode('"'),
11 json_decode(json_encode('"')),
12 json_decode(json_encode('""'))
H A Dbug66025.phpt2 Bug #66025 (Indent wrong when json_encode() called from jsonSerialize function)
8 return json_encode([1], JSON_PRETTY_PRINT);
12 echo json_encode([new Foo]), "\n";
H A Dbug40503.phpt2 Bug #40503 (json_encode() value corruption on 32bit systems with overflown values)
12 json_test_show_eq("$value", json_encode($value));
14 json_test_show_eq("$value", json_encode($value));
H A Dbug54058.phpt8 json_encode($bad_utf8);
13 json_encode($a);
19 json_encode($b);
26 json_encode($c);
H A Dinf_nan_error.phpt10 var_dump(json_encode($inf));
13 var_dump(json_encode($inf, JSON_PARTIAL_OUTPUT_ON_ERROR));
22 var_dump(json_encode($nan));
25 var_dump(json_encode($nan, JSON_PARTIAL_OUTPUT_ON_ERROR));
H A D003.phpt2 json_encode() & endless loop - 1
13 var_dump(json_encode($a));
18 var_dump(json_encode($a, JSON_PARTIAL_OUTPUT_ON_ERROR));
H A Dbug71835.phpt2 Bug #71835 (json_encode sometimes incorrectly detects recursion with JsonSerializable)
12 var_dump(json_encode($arr));
21 var_dump(json_encode($arr));
H A Dbug62369.phpt2 FR #62369 (Segfault on json_encode(deeply_nested_array)
11 json_encode($array, 0, 551);
21 json_encode($array, 0, 540);
H A Djson_encode_exceptions.phpt2 Test json_encode() function : JSON_THROW_ON_ERROR flag
7 var_dump(json_encode("\x80", JSON_THROW_ON_ERROR));
15 var_dump(json_encode("\x80", JSON_THROW_ON_ERROR | JSON_PARTIAL_OUTPUT_ON_ERROR));
41 string(11) "json_encode"
/PHP-8.1/ext/spl/tests/
H A Dsplfixedarray_json_encode.phpt2 json_encode() on SplFixedArray
6 echo json_encode(new SplFixedArray()) . "\n";
7 echo json_encode(new SplFixedArray(1)) . "\n";
12 echo json_encode($a) . "\n";
/PHP-8.1/ext/simplexml/tests/
H A Dbug66084_1.phpt7 echo json_encode(simplexml_load_string('<a><b/><c><x/></c></a>')->c), "\n";
8 echo json_encode(simplexml_load_string('<a><b/><c><x/></c></a>')), "\n";
9 echo json_encode(simplexml_load_string('<a><b/><d/><c><x/></c></a>')), "\n";
10 echo json_encode(simplexml_load_string('<a><b/><c><d/><x/></c></a>')), "\n";
11 echo json_encode(simplexml_load_string('<a><b/><c><d><x/></d></c></a>')), "\n";

Completed in 31 milliseconds

1234