Name

is_callable

Synopsis

int is_callable(callable callback[, int lazy[, string name]])

Returns true if callback is a valid callback, false otherwise. To be valid, callback must either be the name of a function or an array containing two values—an object and the name of a method on that object. If lazy is given and is true, the actual existence of the function in the first form, or that the first element in callback is an object with a method named the second element, is not checked. The arguments merely have to have the correct kind of values to qualify as true. If supplied, the final argument is filled with the callable name for the function—though in the case of the callback being a method on an object, the resulting name in name is not actually usable to call the function directly.

Get Programming PHP, 3rd Edition 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.