3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = 'ABC'; $array[-1] = '123'; var_dump($array);
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Warning: Only the first byte will be assigned to the string offset in /in/HcprF on line 4 string(3) "AB1"
Output for 5.4.2, 5.6.0
Warning: Illegal string offset: -1 in /in/HcprF on line 4 string(3) "ABC"

preferences:
83.38 ms | 402 KiB | 64 Q