3v4l.org

run code in 300+ PHP versions simultaneously
<?php class AbilityScore { public $value; public __construct(int $value) { if ($value < 1) throw new AbilityScoreTooLowException('Ability Score should be at least 1'); $this->value = $value; } public function __set($field, $value) { throw new Exception('Not here mate!'); } } $test = new AbilityScore(10); $test->value = 11; $test->buuu = 'asdsada';
Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.16, 7.0.0 - 7.0.1
Parse error: syntax error, unexpected '__construct' (T_STRING), expecting variable (T_VARIABLE) in /in/XrW5d on line 6
Process exited with code 255.

preferences:
164.94 ms | 1395 KiB | 25 Q