RE: [PHP] Undefined variables

From: Date: Fri, 31 May 2002 04:35:17 +0000
Subject: RE: [PHP] Undefined variables
Groups: php.general 
Request: Send a blank email to php-general+get-100053@lists.php.net to get a copy of this message
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:ccrane@inxdesign.com] Sent: Friday, May 31, 2002 2:33 PM To: php-general@lists.php.net 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" <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'; > } > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#100053) next »