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; } } $t1 = new Test(); $t1->param = true; var_dump($t1); $t1->param = false; var_dump($t1);
based on jAbRD
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.6
__set(param, 1) object(Test)#1 (1) { ["param"]=> string(1) "t" } object(Test)#1 (1) { ["param"]=> bool(false) }