3v4l.org

run code in 500+ 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.33, 8.4.1 - 8.4.24, 8.5.0 - 8.5.9
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.32
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:
56.68 ms | 898 KiB | 4 Q