3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class parentCl { protected function parentMethod($arg) { echo "parent call $arg", PHP_EOL; } } class childCl extends parentCl { public function __construct() { echo "construct", PHP_EOL; } protected function childMethod($params) { echo "child call", PHP_EOL; } protected function childMethod2($params) { echo "child call2", PHP_EOL; } public function __call($name, $args) { call_user_func([$this, $name], ...$args); call_user_func([$this, 'parentMethod'], ...$args); } } //like this case, $n = new childCl(); $n->childMethod(123); $n->childMethod2(1234);
Output for 5.6.0 - 5.6.29, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.29 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0 - 8.5.1
construct child call parent call 123 child call2 parent call 1234
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
45.43 ms | 407 KiB | 5 Q