How can we check for anonymous functions inside PHP arrays?
Example:
$array = array('callback' => function() {
die('calls back');
});
Can we then just simply use in_array, and to something like this:
if( in_array(function() {}, $array) ) {
// Yes! There is an anonymous function inside my elements.
} else {
// Nop! There are no anonymous function inside of me.
}
I'm experimenting with method chaining and PHP's Magic Methods, and I've come to the point where I provide some functions anonymously, and just want to check if they are defined, but I wish not to loop through the object, nor to use gettype, or anything similar.