Re: Undefined variables
| From: | Christopher J. Crane | Date: | Fri, 31 May 2002 04:32:42 +0000 |
| Subject: | Re: Undefined variables | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-100052@lists.php.net to get a copy of this message | ||
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" <mnc@stoic.net> wrote in message
news:Pine.LNX.4.44.0205302126560.28702-100000@stoic.net...
> 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';
> }
>
>