3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php echo "Hello \n"; class foo { protected $values = array(); public function __set($key, $value) { echo "Set:$key to $value \n"; $this->$key = $value; //$this->values[$key] = $value; } public function __get($key) { echo "Get:$key \n"; //return $this->values[$key]; return $this->$key; } } $foo = new foo(); $foo->bar = 'assigning bar'; echo $foo->bar; ?>
based on 6j5Pp
Output for 5.5.0 - 7.3.0rc4
Hello Set:bar to assigning bar assigning bar