Re: Call function and get return...

From: Date: Wed, 16 Aug 2000 08:36:22 +0000
Subject: Re: Call function and get return...
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-11949@lists.php.net to get a copy of this message
Hi Torben, thanks for your answer, but I got the same problem I told Soeren just bevore: echo $func(); will deliever: "f2();" when calling doIt("f2();"); (Unsing PHP 4.0.2pl) Any other ideas ? Regards Martin > It's easier than that. :) Use variable functions instead--no messing > around with eval().. > > <?php > error_reporting(E_ALL); > > function f1() > { > return "Returning from f1()\n"; > } > > function f2() > { > return "Returning from f2()\n"; > } > > function f3() > { > return "Returning from f3()\n"; > } > > function DoIt($func) { > if (function_exists($func)) { > echo $func(); > } > } > > DoIt('f2'); > ?> > > Cheers, > > Torben >

« previous php.general (#11949) next »