3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { function __construct(){ if(isset($this)){ $this->baz = 10; }else{ return new self(); } } } var_dump(A::__construct());
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Non-static method A::__construct() cannot be called statically in /in/EkI5Z:15 Stack trace: #0 {main} thrown in /in/EkI5Z on line 15
Process exited with code 255.
Output for hhvm-3.17.3
Fatal error: Uncaught Error: Non-static method A::__construct() cannot be called statically in /in/EkI5Z:15 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.10.1 - 3.15.4
object(A)#1 (1) { ["baz"]=> int(10) }
Output for 5.5.0 - 5.6.30
Fatal error: Non-static method A::__construct() cannot be called statically in /in/EkI5Z on line 15
Process exited with code 255.