YouTip LogoYouTip

Php Is_Callable Function

# PHP is_callable() Function [![Image 3: PHP Available Functions](#)PHP Available Functions](#) The **is_callable()** function is used to detect whether a function is callable in the current environment. The **is_callable()** function verifies whether the content of a variable can be called as a function. This can check a variable containing a valid function name, or an array containing an object and a function name correctly encoded. PHP Version Requirement: PHP 4 >= 4.0.6, PHP 5, PHP 7 ### Syntax bool is_callable ( callable $name [, bool $syntax_only = false [, string &$callable_name ]] ) Parameter Description: * $name: The callback function to check. * $syntax_only: If set to TRUE, this function only verifies that name could be a function or method. It only rejects non-characters or does not contain a valid structure that can be used for callback functions. A valid structure should contain two elements, the first is an object or a string, and the second element is a string. * $callable_name: Accepts the "callable name". ### Return Value Returns TRUE if name is callable, otherwise returns FALSE. ### Example ## Example The output is: bool(true) someFunction bool(true) someClass::someMethod [![Image 4: PHP Available Functions](#)PHP Available Functions](#)
← Php Is_Numeric FunctionPhp Is_Array Function β†’