3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { var $prop = 1; function __construct($i=null){ if (! $i){ $i = 10; $this = new self(10); } $this->prop = $i; } } $b = new A(); var_dump($b);
Output for 5.1.6 - 7.1.0
Fatal error: Cannot re-assign $this in /in/uTlIM on line 7
Process exited with code 255.
Output for 5.0.5
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/uTlIM on line 3 Fatal error: Cannot re-assign $this in /in/uTlIM on line 7
Process exited with code 255.
Output for 4.4.9
object(a)(1) { ["prop"]=> int(1) }