Re: [PHP] Correct Coding

2003-08-14 Thread Martin Peck
> > That can generate an error if $Task was never assigned a value. > > > > could you not do > > if(@$Task == "Add" ){do something } > > to suppress the error of the variable not being set? I have never seen php give an error if $Task is not set to anything. I would have said that if ("Add" == $

RE: [PHP] Correct Coding

2003-08-14 Thread Matt Schroebel
Roger B.A. Klorese wrote: >>> if ("Add" == $Task) I call that 'defensive programming', defending yourself from yourself! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Correct Coding

2003-08-14 Thread Jim Lucas
<[EMAIL PROTECTED]> Sent: Thursday, August 07, 2003 11:03 AM Subject: RE: [PHP] Correct Coding > > Could you explain a little better why this would make things better? > > > > I don't understand how this would improve things. > > > > > Concerning the $Ta

Re: [PHP] Correct Coding

2003-08-14 Thread Robert Cummings
You can -- but correct me if I'm wrong -- won't that possibly cause an exception to fire which could be extremely heavy if a custom exception handler is implemented? Cheers, Rob. On Thu, 2003-08-07 at 13:35, skate wrote: > > > > That can generate an error if $Task was never assigned a value. >

Re: [PHP] Correct Coding

2003-08-14 Thread Curt Zirzow
* Thus wrote Martin Peck ([EMAIL PROTECTED]): > > > That can generate an error if $Task was never assigned a value. > > > > > > > could you not do > > > > if(@$Task == "Add" ){do something } > > > > to suppress the error of the variable not being set? > > I have never seen php give an error if $Ta

RE: [PHP] Correct Coding

2003-08-14 Thread Crane, Christopher
) 682-6847 -Original Message- From: Juan Nin [mailto:[EMAIL PROTECTED] Sent: Thursday, August 07, 2003 1:17 PM To: Christopher J. Crane Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Correct Coding > Is this the best way to do this? > if(isset($Task) && $Task == "Add&quo

RE: [PHP] Correct Coding

2003-08-14 Thread Roger B.A. Klorese
> Could you explain a little better why this would make things better? > > I don't understand how this would improve things. > > Concerning the $Task == "Add", I'd like to make a comment. It can > > be a wise decision to compare your variables with strings like: > > > > if ("Add" == $Task) > >

Re: [PHP] Correct Coding

2003-08-14 Thread Robert Cummings
That can generate an error if $Task was never assigned a value. Cheers, Rob. On Thu, 2003-08-07 at 13:17, Juan Nin wrote: > > Is this the best way to do this? > > if(isset($Task) && $Task == "Add") { Do something } > > I want to check if the variable is set and if so, if it is "Add". > > why do

Re: [PHP] Correct Coding

2003-08-11 Thread Curt Zirzow
* Thus wrote Christopher J. Crane ([EMAIL PROTECTED]): > Is this the best way to do this? > > if(isset($Task) && $Task == "Add") { Do something } > > I want to check if the variable is set and if so, if it is "Add". Yes, that is good. Remember, though, it is case sensitive so "ADD" wont match.

Re: [PHP] Correct Coding

2003-08-11 Thread skate
> That can generate an error if $Task was never assigned a value. > could you not do if(@$Task == "Add" ){do something } to suppress the error of the variable not being set? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Correct Coding

2003-08-08 Thread Jim Lucas
Could you explain a little better why this would make things better? I don't understand how this would improve things. Jim Lucas - Original Message - From: "Curt Zirzow" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, August 07, 2003 10:28 AM

Re: [PHP] Correct Coding

2003-08-07 Thread Juan Nin
> Is this the best way to do this? > if(isset($Task) && $Task == "Add") { Do something } > I want to check if the variable is set and if so, if it is "Add". why don't just do: if($Task == "Add") { Do something } regards, Juan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, v

Re: [PHP] Correct Coding

2003-08-07 Thread Robert Cummings
Looks good. Cheers, Rob. On Thu, 2003-08-07 at 13:09, Christopher J. Crane wrote: > Is this the best way to do this? > > if(isset($Task) && $Task == "Add") { Do something } > > I want to check if the variable is set and if so, if it is "Add". > > > > > -- > PHP General Mailing List (http:/

Re: [PHP] Correct Coding

2003-08-07 Thread CPT John W. Holmes
From: "Martin Peck" <[EMAIL PROTECTED]> > > > That can generate an error if $Task was never assigned a value. > > > > > > > could you not do > > > > if(@$Task == "Add" ){do something } > > > > to suppress the error of the variable not being set? > > I have never seen php give an error if $Task is n