3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { static protected $count = 0; protected $data = [1,2,3,5]; public function data() { return $this->data; } } class B extends A { protected $data = [5,6,7,89]; public function data() { self::$count++; echo self::$count, ""\n"; if (self::$count === 10) return; return static::data(); } } $b = new B(); var_dump($b->data());
Output for 5.6.0 - 5.6.26, 7.0.0 - 7.0.11
Parse error: syntax error, unexpected '\' (T_NS_SEPARATOR), expecting ',' or ';' in /in/nuvus on line 12
Process exited with code 255.

preferences:
177.03 ms | 940 KiB | 47 Q