3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Grandpa { public function test() { echo 'Grandpa test' . PHP_EOL; } } class Papa extends Grandpa { public function test() { echo 'Papa test before' . PHP_EOL; parent::test(); echo 'Papa test after' . PHP_EOL; } } class Kiddo extends Papa { public function test() { echo 'Kiddo test before' . PHP_EOL; parent::parent::test(); echo 'Kiddo test after' . PHP_EOL; } } (new Kiddo())->test();
Output for 8.1.23 - 8.1.28, 8.2.10 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Kiddo test before Fatal error: Uncaught Error: Undefined constant Papa::parent in /in/22YAQ:27 Stack trace: #0 /in/22YAQ(32): Kiddo->test() #1 {main} thrown in /in/22YAQ on line 27
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 Kiddo test before Fatal error: Uncaught Error: Undefined constant Papa::parent in /in/22YAQ:27 Stack trace: #0 /in/22YAQ(32): Kiddo->test() #1 {main} thrown in /in/22YAQ on line 27
Process exited with code 255.
Output for 5.6.38, 7.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.15, 7.3.0 - 7.3.2
Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM) in /in/22YAQ on line 27
Process exited with code 255.

preferences:
106.73 ms | 402 KiB | 74 Q