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.29, 8.2.0 - 8.2.22, 8.3.0 - 8.3.10
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:
138.47 ms | 404 KiB | 130 Q