3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { public static $var_1 = 'foo_var'; public function printItem($string) { echo 'Foo: ' . $string . PHP_EOL; } public function printPHP() { echo 'PHP is great.' . PHP_EOL; } } class bar extends foo { public static $var_1 = 'bar_var'; public static function printItem($string) { echo 'Bar: ' . self::$var_1 . PHP_EOL; } } bar::printItem('baz');
Output for 5.3.0 - 5.3.24, 5.4.0 - 5.4.14
Fatal error: Cannot make non static method foo::printItem() static in class bar in /in/q3Qtd on line 23
Process exited with code 255.

preferences:
172.21 ms | 1395 KiB | 47 Q