<?php $message = "Работа не может быть продолжена из-за ошибок:<br />"; $check = function(array $errors) use ($message) { if (isset($errors) && count($errors) > 0) { echo $message; foreach($errors as $error) { echo "$error<br />"; } } }; $check([]); $erorrs[] = "Заполните имя пользователя"; $check($erorrs); $message = "Список требований"; $erorrs = ["PHP", "MySQL", "memcache"]; $check($erorrs); ?> 

And what does $check([]) mean?

    1 answer 1

    $check([]) is a function call to check for errors.

    The check is in the if (isset($errors) && count($errors) > 0) { string if (isset($errors) && count($errors) > 0) { and the function itself will generate a call error if it does not exist.

    It was possible to write $check = function(array $errors = []) use ($message) , which would set the default value.