I like this piece of code. In fact, I convert all my scripts that use the older If/Else code. What would happen if the "break; " wasn't used. Would it just continue through the rest of the function to find another match???
"Miguel Cruz" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Thu, 30 May 2002, Crane, Christopher wrote: > > if ($Task == "ShowVersion") { function ShowVersion(); } > > elseif ($Task == "GetData") { function GetData(); print "$DataOutput"; } > > elseif ($Task == "CreateImage") { function CreateImage(); } > > else { print "Incorrect Variable or no Variable Supplies<br>"; } > > if (isset($Task)) > { > switch($Task) > { > case 'ShowVersion': > ShowVersion(); > break; > case 'GetData': > GetData; > print $DataOutput; > break; > case 'CreateImage': > CreateImage(); > break; > default: > print 'Unknown function'; > } > } else { > print 'No function supplied'; > } > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php