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.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
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:
122.63 ms | 407 KiB | 5 Q