3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $bar; function __construct(Foo $foo = null) { if($foo == null) { $foo = new Foo($this); } $this->bar = $foo; } function __construct(Foo $foo = null) { $this->Foo($foo); } } $a = new Foo(); print_r($a);
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.31
Fatal error: Cannot redeclare Foo::__construct() in /in/aV2pR on line 13
Process exited with code 255.

preferences:
188.01 ms | 1395 KiB | 68 Q