3v4l.org

run code in 300+ PHP versions simultaneously
<?php //класс Validator //$this->rules - массив, в котором ключи - строки - названия полей, а элементы - массив, в котором ключи цифры от 0 до n, а //элементы - объекты-правила-валидации. public function validate(Enrollee $enrollee): ErrorList { $errorList = new ErrorList(); foreach ($this->rules as $fieldName => $checklist) { foreach ($checklist as $rule) { $result = $rule($enrollee->get($fieldName)); if ($result) { $errorList->add($fieldName, $result); } } } return $errorList; }
Output for 8.1.0 - 8.1.27, 8.2.0 - 8.2.14, 8.3.0 - 8.3.1
Parse error: syntax error, unexpected token "public", expecting end of file in /in/v85Gq on line 7
Process exited with code 255.

preferences:
150.9 ms | 1400 KiB | 52 Q