3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php abstract class C { private $s; public function __construct($s) { $this->s = $s; } //or protected function getS() { public final function __toString() { return $this->s; } } class C1 extends C { public function __get($name) { $value = 'wanted:'.$name; $this->$name = $value.',got it again'; return $value; } public function __construct($s1) { parent::__construct($s1); } function doStuff() { echo $this."\n"; echo $this->s."\n"; echo $this->s."\n"; } } $c1 = new C1('foo'); $c1->doStuff();
based on KuTGX
Output for 5.3.20 - 7.2.0
foo wanted:s wanted:s,got it again