3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function boolToStr(&$value) { if($value === true) { $value = 't'; } elseif($value === false) { $value = 'f'; } } class Test { function __set($name, $value) { print "__set($name, $value)\n"; if(is_bool($value)) { boolToStr($value); } $this->$name = $value; } function __get($name, $value) { print "__get($name, $value)\n"; } } $t1 = new Test(); $t1->param = true; var_dump($t1); $t1->param = false; var_dump($t1);
based on ePbkA
Output for 7.0.0 - 7.1.7
Fatal error: Method Test::__get() must take exactly 1 argument in /in/rD7Mt on line 20
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught Error: Method Test::__get() must take exactly 1 argument in /in/rD7Mt:19 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Fatal error: Method Test::__get() must take exactly 1 argument in /in/rD7Mt on line 21
Process exited with code 255.