Re: Re: dynamically selecting a function
| From: | Norbert Wenzel | Date: | Mon, 08 Aug 2005 09:30:04 +0000 |
| Subject: | Re: Re: dynamically selecting a function | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-220208@lists.php.net to get a copy of this message | ||
Thomas wrote:
Thanks Burhan. Is there much overhead? Norbert: that's what I am doing now, just wanted to save some code. :-) Thomas -----Original Message----- From: Norbert Wenzel [mailto:mail@brain4art.at] Sent: 08 August 2005 11:18 AM To: php-general@lists.php.net Subject: [PHP] Re: dynamically selecting a function Thomas wrote:i thought that would be too easy ;-)Hi there, How can I do something like this: [snip - theoretical code] if( isset($step) ) echo step.$step() ) [/snip] $step would be an int (I would check that before) and then I would haveallsorts of functions like step1(), step2() . etc. Any ideas? ThomasWhat about switch / case? switch($step) { case 1: step1(); break; case 2: step2(); break; default: defaultStep(); break; }