Re: passing a function as a parameter

From: Date: Fri, 11 Jun 2004 18:30:04 +0000
Subject: Re: passing a function as a parameter
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-188126@lists.php.net to get a copy of this message
call_user_func($func) and $func() are much better alternatives. Daniel Clark wrote:
Can you use eval() ?
I want to pass a function as a parameter and execute it in another function. A callback. :-) For example: function a() {
    echo "a";
} function b( $func ) {
    func();
    echo "b";
} The output of "b( a )" will be "ab".
-- paperCrane <Justin Patrin>

« previous php.general (#188126) next »