3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* This breaks depending on the version of PHP PHP 5 generates the following Strict Standards: Declaration of Daz::delete() should be compatible with Foo::delete($completely = true) on line 51 Strict Standards: Declaration of Jaz::delete() should be compatible with Foo::delete($completely = true) on line 62 Foo::delete(1) Baz::delete(1, ) Daz::delete(1) Jaz::delete(1) PHP 7 generates the following Warning: Declaration of Daz::delete($newsletterid) should be compatible with Foo::delete($completely = true) on line 51 Warning: Declaration of Jaz::delete() should be compatible with Foo::delete($completely = true) on line 62 Foo::delete(1) Baz::delete(1, ) Daz::delete(1) Jaz::delete(1) */ class Foo { public function delete($completely = true) { echo "Foo::delete($completely)".PHP_EOL; } } class Baz extends Foo { public function delete($completely = true, $lang = false) { echo "Baz::delete($completely, $lang)".PHP_EOL; } } class Daz extends Foo { public function delete($newsletterid) { echo "Daz::delete($newsletterid)".PHP_EOL; } } class Jaz extends Foo { public function delete($newsletterid = '') { echo "Jaz::delete($newsletterid)".PHP_EOL; } } $foo = new Foo(); $baz = new Baz(); $daz = new Daz(); $jaz = new Jaz(); $foo->delete(); echo PHP_EOL; $baz->delete(); echo PHP_EOL; $daz->delete(1); echo PHP_EOL; $jaz->delete(1);
Output for 8.5.0 - 8.5.1
Fatal error: Declaration of Daz::delete($newsletterid) must be compatible with Foo::delete($completely = true) in /in/hMN5P on line 47 Stack trace: #0 {main}
Process exited with code 255.
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.
Output for 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
Fatal error: Declaration of Daz::delete($newsletterid) must be compatible with Foo::delete($completely = true) in /in/hMN5P on line 47
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Declaration of Daz::delete($newsletterid) should be compatible with Foo::delete($completely = true) in /in/hMN5P on line 47 Foo::delete(1) Baz::delete(1, ) Daz::delete(1) Jaz::delete(1)
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33
Warning: Declaration of Daz::delete($newsletterid) should be compatible with Foo::delete($completely = true) in /in/hMN5P on line 51 Foo::delete(1) Baz::delete(1, ) Daz::delete(1) Jaz::delete(1)

preferences:
187.17 ms | 412 KiB | 5 Q