3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { public static function foo() { return new B; } } class B extends A { private function __construct() { } } $b = A::foo(); $b2 = new B;
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to private B::__construct() from context 'A' in /in/girmg:5 Stack trace: #0 /in/girmg(13): A::foo() #1 {main} thrown in /in/girmg on line 5
Process exited with code 255.
Output for hhvm-3.11.1 - 3.17.3
Fatal error: Uncaught Error: Call to private method B::__construct() from context 'A' in /in/girmg:5 Stack trace: #0 /in/girmg(13): A::foo() #1 {main}
Process exited with code 255.
Output for hhvm-3.10.1
Fatal error: Call to private method B::__construct() from context 'A' in /in/girmg on line 5
Process exited with code 255.
Output for 5.3.0 - 5.6.30
Fatal error: Call to private B::__construct() from context 'A' in /in/girmg on line 5
Process exited with code 255.