> Of course this is faster, but how did you choose FuncThree as the one that > needs to be run? And if you already know you need to run FuncThree, what > would be the point of any conditionals (and why not just call it > directly)? Maybe I'm not understanding the original premise, but comparing > conditionals to a function call seems... strange. >
The way that I have done this in the past is to use an associative array to do the lookup of the name of the function to call. It ends up looking something like this: <?php //-- create an array that associates options with functions $funcArray['option1'] = 'function1'; $funcArray['option2'] = 'function2'; $funcArray['option3'] = 'function3'; //-- assuming $option is a var that has the option in it //-- get the name of the function $function = $funcArray[$option]; //-- call the function $function(); ?> What I don't know, is if the lookup in the associative array is faster than a switch or if/else. My gut feeling is that it would be faster because it is going to use PHP's built-in memory lookups. --John _______________________________________________ UPHPU mailing list [email protected] http://uphpu.org/mailman/listinfo/uphpu IRC: #uphpu on irc.freenode.net
