- Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.30, 5.6.8 - 5.6.14
- Parse error: syntax error, unexpected 'class' (T_CLASS) in /in/VdKnF on line 3
Process exited with code 255.
<?php
$person = new class($controller) {
public $age = 15, $height = 72, $weight = 200;
public function __set($name, $value) {
if (!property_exists($controller)) {
throw new Exception("No such property: $name");
}
}
public function __get($name, $value) {
if (!property_exists($controller)) {
throw new Exception("No such property: $name");
}
}
};
var_dump($person);
var_dump($person->age);
$person->badProp = 5;