Re: [PHP] variable function call (Re: [PHP] unset a function?)
Hey Bas, BVBut i would prefer something like BV$temp=make_$wat($this); I think you might want something along these lines: eval(make_$wat($this);); HTH -jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] variable function call (Re: [PHP] unset a function?)
Hoi Bas, $func = make_ . $wat; $temp = $$func($this); bvr. On Thu, 31 Jan 2002 11:55:12 +0100, Bas Jobsen wrote: Hello, Thanks all. I will rename the second function. Now if have: if($wat==naam)$temp=make_naam($this); else if($wat==anderenaam)$temp=make_anderenaam($this); //etc.. But i would prefer something like $temp=make_$wat($this); How can i do this? Tnx, Bas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] variable function call (Re: [PHP] unset a function?)
On Thu, 2002-01-31 at 02:55, Bas Jobsen wrote: Hello, Thanks all. I will rename the second function. Now if have: if($wat==naam)$temp=make_naam($this); else if($wat==anderenaam)$temp=make_anderenaam($this); //etc.. But i would prefer something like $temp=make_$wat($this); How can i do this? Tnx, Bas Use variable function names, like so: ?php error_reporting(E_ALL); function make_naam() { return 'naam'; } function make_anderenaam() { return 'andernaam'; } $wat = 'naam'; $func = 'make_' . $wat; echo $func(); ? Essentially, if you stick an argument list on the end of a variable name, that variable will be evaluated and used as the name of a function to call. Hope this helps, Torben -- Torben Wilson [EMAIL PROTECTED] http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] variable function call (Re: [PHP] unset a function?)
Hello, $func = make_ . $wat; $temp = $$func($this); I think one $. $func = make_ . $wat; $temp = $func($this); will work Bas Op donderdag 31 januari 2002 12:17, schreef u: Hoi Bas, $func = make_ . $wat; $temp = $$func($this); bvr. On Thu, 31 Jan 2002 11:55:12 +0100, Bas Jobsen wrote: Hello, Thanks all. I will rename the second function. Now if have: if($wat==naam)$temp=make_naam($this); else if($wat==anderenaam)$temp=make_anderenaam($this); //etc.. But i would prefer something like $temp=make_$wat($this); How can i do this? Tnx, Bas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]