note 96321 deleted from function.create-function by cmb
| From: | cmb@php.net | Date: | Thu, 07 Jul 2022 14:40:32 +0000 |
| Subject: | note 96321 deleted from function.create-function by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218925@lists.php.net to get a copy of this message | ||
Note Submitter: v dot churakov at i2d dot ru
----
<?
function is_function( &$mixed )
{
if ( is_object( $mixed ) ) {
return ( $mixed instanceof Closure );
} elseif( is_string( $mixed ) ) {
return function_exists( $mixed );
} else {
return false;
}
}
function myfunc(){}
$test = 123;
echo is_function( $test ); //will return false
$test = 'isset';
echo is_function( $test ); //will return false... it's not work with reserved :( ...
$test = 'myfunc';
echo is_function( $test ); //will return true
$test = create_function( '', 'echo 123;' );
echo is_function( $test ); //will return true
$test = function () { echo 123; };
echo is_function( $test ); //will return true
?>