3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A{ private $id='iddebut'; private $nomTest='nomdebut'; public function __call($name, $args) { echo "\n----".$name; var_dump($args); } public function __get($name) { echo "\ngetting----".$name; return $this->$name; } public function __set($name, $args) { echo "\nsetting".$name; var_dump($args); $this->$name=$args; return $this; ///fdf } } $a = new A(); echo "\n".$a->getId('ceci est un argument'); echo "\n".$a->id; echo "\n".$a->nomTest; $a->id = 'nouvel id'; $a->nomTest = 'nouvel id';
based on Af3ij
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.1.0 - 7.3.0beta1
----getIdarray(1) { [0]=> string(20) "ceci est un argument" } getting----id iddebut getting----nomTest nomdebut settingidstring(9) "nouvel id" settingnomTeststring(9) "nouvel id"