3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Something { public function __construct(protected string $a, public int $b) { var_dump(debug_backtrace(limit: 1)); var_dump(func_get_args()); } } $s_ordered = new Something('yo', 1337); var_dump($s_ordered); print "---------------\n"; $s_named = new Something(b: 1337, a: 'yo'); var_dump($s_named);
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.15, 8.4.1 - 8.4.2
array(1) { [0]=> array(7) { ["file"]=> string(9) "/in/17UTb" ["line"]=> int(10) ["function"]=> string(11) "__construct" ["class"]=> string(9) "Something" ["object"]=> object(Something)#1 (2) { ["a":protected]=> string(2) "yo" ["b"]=> int(1337) } ["type"]=> string(2) "->" ["args"]=> array(2) { [0]=> string(2) "yo" [1]=> int(1337) } } } array(2) { [0]=> string(2) "yo" [1]=> int(1337) } object(Something)#1 (2) { ["a":protected]=> string(2) "yo" ["b"]=> int(1337) } --------------- array(1) { [0]=> array(7) { ["file"]=> string(9) "/in/17UTb" ["line"]=> int(15) ["function"]=> string(11) "__construct" ["class"]=> string(9) "Something" ["object"]=> object(Something)#2 (2) { ["a":protected]=> string(2) "yo" ["b"]=> int(1337) } ["type"]=> string(2) "->" ["args"]=> array(2) { [0]=> string(2) "yo" [1]=> int(1337) } } } array(2) { [0]=> string(2) "yo" [1]=> int(1337) } object(Something)#2 (2) { ["a":protected]=> string(2) "yo" ["b"]=> int(1337) }

preferences:
76.97 ms | 410 KiB | 5 Q