Re: passing a function as a parameter

From: Date: Fri, 11 Jun 2004 14:36:39 +0000
Subject: Re: passing a function as a parameter
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-188104@lists.php.net to get a copy of this message
I'am not sure what you wanna do, but if you want to send a parameter use something like this one: <? function a() {
    return "a";
} function b($val) {
    echo $val."b";
} b(a()); ?> or you can always use classes... On Fri, 11 Jun 2004 10:25:54 -0400, Bob Lockie <bjlockie@lockie.ca> wrote:
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".
-- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

« previous php.general (#188104) next »