3v4l.org

run code in 300+ PHP versions simultaneously
<?php function d($v) { $r = json_decode($v); var_dump($r); } d('{"foo":"bar"}'); d('{"foo":[1,2]}'); d('{"foo":[{"bar":"baz"}]}');
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.14, 8.4.1
object(stdClass)#1 (1) { ["foo"]=> string(3) "bar" } object(stdClass)#1 (1) { ["foo"]=> array(2) { [0]=> int(1) [1]=> int(2) } } object(stdClass)#2 (1) { ["foo"]=> array(1) { [0]=> object(stdClass)#1 (1) { ["bar"]=> string(3) "baz" } } }

preferences:
54.25 ms | 407 KiB | 5 Q