3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Test { protected $id; public function __set($key, $value) { if (isset($this->$key)) $this->$key = $value; // throw new Exception() could be added here } public function __get($key) { return isset($this->$key) ? $this->$key : null; } public function __call($name, $arguments) { $matches = array(); $pattern = '/^set([A-Za-z0-9]+)/'; if (preg_match($pattern, $name, &$matches)) { var_dump($arguments, $matches); //$this-> } } } $test = new Test; $test->setId(25);
Output for 5.4.0 - 5.4.13
Fatal error: Call-time pass-by-reference has been removed in /in/4nkNm on line 23
Process exited with code 255.
Output for 5.3.25, 5.3.27 - 5.3.29
Deprecated: Call-time pass-by-reference has been deprecated in /in/NXYbD on line 23 array(1) { [0]=> int(25) } array(2) { [0]=> string(5) "setId" [1]=> string(2) "Id" }
Output for 5.3.0 - 5.3.24, 5.3.26
Deprecated: Call-time pass-by-reference has been deprecated in /in/4nkNm on line 23 array(1) { [0]=> int(25) } array(2) { [0]=> string(5) "setId" [1]=> string(2) "Id" }