note 96321 added to function.create-function

From: Date: Sat, 20 Feb 2010 12:56:38 +0000
Subject: note 96321 added to function.create-function
Groups: php.notes 
Request: Send a blank email to php-notes+get-166208@lists.php.net to get a copy of this message
<? 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 ?> ---- Server IP: 195.54.192.44 Probable Submitter: 127.0.0.1 ---- Manual Page -- http://www.php.net/manual/en/function.create-function.php Edit -- https://master.php.net/note/edit/96321 Del: integrated -- https://master.php.net/note/delete/96321/integrated Del: useless -- https://master.php.net/note/delete/96321/useless Del: bad code -- https://master.php.net/note/delete/96321/bad+code Del: spam -- https://master.php.net/note/delete/96321/spam Del: non-english -- https://master.php.net/note/delete/96321/non-english Del: in docs -- https://master.php.net/note/delete/96321/in+docs Del: other reasons-- https://master.php.net/note/delete/96321 Reject -- https://master.php.net/note/reject/96321 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#166208) next »