3v4l.org

run code in 150+ 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.1.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.10.0 - 3.12.0
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.2.15 - 5.6.28
Fatal error: Call to private B::__construct() from context 'A' in /in/girmg on line 5
Process exited with code 255.