3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ "-1" => "item 1", "1" => "item 2", "\0-1" => "item 3", ]; print_r($arr); var_dump($arr); foreach ($arr as $k => $v) { print bin2hex($k) ."\n"; }
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.26, 8.3.0 - 8.3.14, 8.4.1
Array ( [-1] => item 1 [1] => item 2 [-1] => item 3 ) array(3) { [-1]=> string(6) "item 1" [1]=> string(6) "item 2" ["-1"]=> string(6) "item 3" } 2d31 31 002d31

preferences:
66.88 ms | 407 KiB | 5 Q