3v4l.org

run code in 300+ PHP versions simultaneously
<?php set_error_handler(function () { throw new Exception("foo"); }); class MyArrayAcess implements ArrayAccess { public function offsetExists(mixed $offset): mixed {} public function offsetGet(mixed $offset): mixed {} public function offsetSet(mixed $offset, mixed $value): void {} public function offsetUnset(mixed $offset): void {} }
Output for 8.4.1 - 8.4.12
Fatal error: During inheritance of ArrayAccess: Uncaught Exception: foo in /in/6sbhF:4 Stack trace: #0 /in/6sbhF(7): {closure:/in/6sbhF:3}(8192, 'Return type of ...', '/in/6sbhF', 8) #1 {main} in /in/6sbhF on line 7
Process exited with code 255.
Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.4, 8.3.6 - 8.3.25
Fatal error: During inheritance of ArrayAccess: Uncaught Exception: foo in /in/6sbhF:4 Stack trace: #0 /in/6sbhF(7): {closure}(8192, 'Return type of ...', '/in/6sbhF', 8) #1 {main} in /in/6sbhF on line 7
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: During inheritance of ArrayAccess: Uncaught Exception: foo in /in/6sbhF:4 Stack trace: #0 /in/6sbhF(7): {closure}(8192, 'Return type of ...', '/in/6sbhF', 8) #1 {main} in /in/6sbhF on line 7
Process exited with code 255.
Output for 8.0.0 - 8.0.30
Output for 7.4.0 - 7.4.33
Fatal error: Declaration of MyArrayAcess::offsetExists(mixed $offset): mixed must be compatible with ArrayAccess::offsetExists($offset) in /in/6sbhF on line 8
Process exited with code 255.
Output for 7.3.0 - 7.3.33
Fatal error: Declaration of MyArrayAcess::offsetExists(mixed $offset): mixed must be compatible with ArrayAccess::offsetExists($offset) in /in/6sbhF on line 7
Process exited with code 255.

preferences:
119.32 ms | 413 KiB | 5 Q