3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { function __toString() { return 'A'; } } $a = new A(); $b = [$a => $a]; print_r($b);
Output for 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Fatal error: Uncaught TypeError: Cannot access offset of type A on array in /in/4teSv:11 Stack trace: #0 {main} thrown in /in/4teSv on line 11
Process exited with code 255.
Output for 8.1.34, 8.2.0 - 8.2.30
Fatal error: Uncaught TypeError: Illegal offset type in /in/4teSv:11 Stack trace: #0 {main} thrown in /in/4teSv on line 11
Process exited with code 255.

preferences:
52.85 ms | 854 KiB | 4 Q