3v4l.org

run code in 500+ 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.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.35, 8.3.0 - 8.3.36, 8.4.1 - 8.4.27, 8.5.0 - 8.5.12
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:
40.3 ms | 1508 KiB | 8 Q