Illegal function name¶
Description¶
This error messages appears when there is an attempt to create a closure from a function, whose name is not a valid function. Numbers, such as float and integers, are not valid function name, and yield this error. Negative numbers, and other types yield a distinct error.
Example¶
<?php
const Closure = (0)(...);
var_dump(Closure);
?>
Solutions¶
Use a string, instead of a number. Check that the string is a valid name for a function or a static method.
Ensures that the name is a static expression, and that each element may be resolved at compile time.
Changed Behavior¶
This error may appear following an evolution in behavior, in previous versions. See ` <https://php-changed-behaviors.readthedocs.io/en/latest/behavior/.html>`_.