3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{"test" : "test one \xe0, \x270B"}'; echo var_export(json_validate($json), true); $json = preg_replace_callback( pattern: '/\\\\x([[:xdigit:]]+)/', callback: fn($m) => sprintf('\u%04s', $m[1]), subject: $json, count: $count ); echo "\n$count"; echo "\n" . var_export(json_validate($json), true); echo "\n$json\n"; var_export(json_decode($json));
Output for 8.3.0 - 8.3.7
false 2 true {"test" : "test one \u00e0, \u270B"} (object) array( 'test' => 'test one à, ✋', )
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Fatal error: Uncaught Error: Call to undefined function json_validate() in /in/gbRIs:5 Stack trace: #0 {main} thrown in /in/gbRIs on line 5
Process exited with code 255.
Output for 7.4.2 - 7.4.28
Parse error: syntax error, unexpected ':', expecting ')' in /in/gbRIs on line 8
Process exited with code 255.
Output for 7.2.16
Parse error: syntax error, unexpected ':', expecting ',' or ')' in /in/gbRIs on line 8
Process exited with code 255.

preferences:
95.06 ms | 401 KiB | 64 Q