3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class test { function test($p) { $p[] = 'test'; } } $tp = ['asd','sad']; $tc = new tets(); $tc->test($tp); var_dump($tp); die; abstract class T { static public $instanses; final private function __construct(){ } public static function getInstance() { if (!(static::$instanses instanceof static)) { static::$instanses = new static; } return static::$instanses; } } class A extends T { static public $instanses; } class B extends A { static public $instanses; } $t = A::getInstance(); var_dump($t); $t1 = B::getInstance(); var_dump($t1); new B(); ?>
based on muGe1
Output for 7.0.0 - 7.2.0
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; test has a deprecated constructor in /in/ZICbp on line 2 Fatal error: Uncaught Error: Class 'tets' not found in /in/ZICbp:8 Stack trace: #0 {main} thrown in /in/ZICbp on line 8
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Fatal error: Class 'tets' not found in /in/ZICbp on line 8
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/ZICbp on line 7
Process exited with code 255.