3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = ""; $x['foo'] = 'bar'; echo $x ?>
Output for 8.0.7 - 8.0.30, 8.1.0 - 8.1.29, 8.2.0 - 8.2.21, 8.3.0 - 8.3.9
Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /in/grbcp:3 Stack trace: #0 {main} thrown in /in/grbcp on line 3
Process exited with code 255.
Output for 8.0.0 - 8.0.6
Warning: Only the first byte will be assigned to the string offset in /in/grbcp on line 3 Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /in/grbcp:3 Stack trace: #0 {main} thrown in /in/grbcp on line 3
Process exited with code 255.
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: Illegal string offset 'foo' in /in/grbcp on line 3 b
Output for 7.0.0 - 7.0.33
Notice: Array to string conversion in /in/grbcp on line 4 Array
Output for 5.6.0 - 5.6.40
Notice: Array to string conversion in /in/grbcp on line 5 Array

preferences:
177.31 ms | 403 KiB | 298 Q