3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Foo { abstract protected static function things(); protected $t; protected function __construct($t) { $this->t = $t; } public function getT() { return $this->t; } public static function all() { return array_map(function($t) { return static($t); }, static::things()); } } class Bar extends Foo { protected static function things() { return [10, 20, 30]; } } $bars = Bar::all(); foreach ($bars as $bar) { echo $bar->getT()."\n"; }
Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.29, 5.6.7 - 5.6.13
Strict Standards: Static function Foo::things() should not be abstract in /in/7hCu7 on line 4 Parse error: syntax error, unexpected '(', expecting :: (T_PAAMAYIM_NEKUDOTAYIM) in /in/7hCu7 on line 15
Process exited with code 255.

preferences:
172.39 ms | 1395 KiB | 63 Q