Name

is_callable()

Synopsis

    bool is_callable ( mixed var [, bool check_syntax_only [, string &proper_
    name]] )

The is_callable() function takes a string as its only parameter and returns true if that string contains a function name that can be called using a variable function. For example:

    $func = "sqrt";
    if (is_callable($func)) {
            print $func(49);
    }

Get PHP in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.