.. _illegal-function-name: Illegal function name --------------------- .. meta:: :description: Illegal function name: This error messages appears when there is an attempt to create a closure from a function, whose name is not a valid function. :og:image: https://php-errors.readthedocs.io/en/latest/_static/logo.png :og:type: article :og:title: Illegal function name :og:description: This error messages appears when there is an attempt to create a closure from a function, whose name is not a valid function :og:url: https://php-errors.readthedocs.io/en/latest/messages/illegal-function-name.html :og:locale: en :twitter:card: summary_large_image :twitter:site: @exakat :twitter:title: Illegal function name :twitter:description: Illegal function name: This error messages appears when there is an attempt to create a closure from a function, whose name is not a valid function :twitter:creator: @exakat :twitter:image:src: https://php-errors.readthedocs.io/en/latest/_static/logo.png .. raw:: html 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 _______ .. code-block:: php 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. Related Error Messages ______________________ + :ref:`cannot-use-dynamic-function-name-in-constant-expression` Changed Behavior ________________ This error may appear following an evolution in behavior, in previous versions. See ` `_.