[PHP] Setting flags versus checking for existing/nonexisting values

2006-08-15 Thread Chris W. Parker
Hello, Is it a better practice to set flags to determine the action of your code or is it perfectly acceptable to have your code determine what it should do based on the existence (or lack thereof) of data? For example: ?php if($value == 1) { $flag = true; } if($flag === true) {

Re: [PHP] Setting flags versus checking for existing/nonexisting values

2006-08-15 Thread Brad Bonkoski
Chris W. Parker wrote: Hello, Is it a better practice to set flags to determine the action of your code or is it perfectly acceptable to have your code determine what it should do based on the existence (or lack thereof) of data? For example: ?php if($value == 1) { $flag = true; }

RE: [PHP] Setting flags versus checking for existing/nonexisting values

2006-08-15 Thread Chris W. Parker
Brad Bonkoski mailto:[EMAIL PROTECTED] on Tuesday, August 15, 2006 10:04 AM said: Pros: potentially more readable code. Cons: Wasted energy typing unnecessary lines of code. Really I would say it comes down to coder preference. (and why would you avoid the latter all together? Testing

RE: [PHP] Setting flags versus checking for existing/nonexisting values

2006-08-15 Thread Robert Cummings
On Tue, 2006-08-15 at 10:12 -0700, Chris W. Parker wrote: Brad Bonkoski mailto:[EMAIL PROTECTED] on Tuesday, August 15, 2006 10:04 AM said: Pros: potentially more readable code. Cons: Wasted energy typing unnecessary lines of code. Really I would say it comes down to coder

Re: [PHP] Setting flags versus checking for existing/nonexisting values

2006-08-15 Thread Richard Lynch
On Tue, August 15, 2006 11:53 am, Chris W. Parker wrote: Is it a better practice to set flags to determine the action of your code or is it perfectly acceptable to have your code determine what it should do based on the existence (or lack thereof) of data? For example: ?php if($value ==

Re: [PHP] Setting flags versus checking for existing/nonexisting values

2006-08-15 Thread tedd
On Tue, August 15, 2006 11:53 am, Chris W. Parker wrote: Is it a better practice to set flags to determine the action of your code or is it perfectly acceptable to have your code determine what it should do based on the existence (or lack thereof) of data? For example: -snip- flag example