3v4l.org

run code in 300+ PHP versions simultaneously
<?php $inputs = [ 'invalid', 'true', 'false', 'null', '17', '17.19', '{"foo":"bar"}', '[{"foo":"bar"}]', '{"0":"foo","bar":{"17":"baz"}}', ]; foreach ($inputs as $input) { var_dump(json_decode($input)); }
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
NULL bool(true) bool(false) NULL int(17) float(17.19) object(stdClass)#1 (1) { ["foo"]=> string(3) "bar" } array(1) { [0]=> object(stdClass)#1 (1) { ["foo"]=> string(3) "bar" } } object(stdClass)#1 (2) { ["0"]=> string(3) "foo" ["bar"]=> object(stdClass)#2 (1) { ["17"]=> string(3) "baz" } }

preferences:
136.52 ms | 403 KiB | 123 Q