if you want to do the same thing for "no task supplied" and "unknown task"
then you could do this:
switch(@$Task)
{
case 'ShowVersion':
ShowVersion();
break;
case 'GetData':
GetData;
print $DataOutput;
break;
case 'CreateImage':
CreateImage();
break;
default:
print 'Unknown function or No function supplied';
}
basically, suppress warnings
-----Original Message-----
From: Christopher J. Crane [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 31, 2002 2:33 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Undefined variables
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php