Re: Friday morning brain farts....

From: Date: Mon, 13 Aug 2007 10:10:45 +0000
Subject: Re: Friday morning brain farts....
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.general 
Request: Send a blank email to php-general+get-260758@lists.php.net to get a copy of this message
On 8/13/07, tedd <tedd@sperling.com> wrote: > At 4:54 PM +0200 8/11/07, Tijnema wrote: > >On 8/11/07, tedd <tedd@sperling.com> wrote: > >> At 7:21 PM +0200 8/10/07, Tijnema wrote: > >> >On 8/10/07, Robert Cummings <robert@interjinn.com> wrote: > >> > > > > > > if( !isset( $argv[1] ) || !isset( $argv[2] ) || !isset( $argv[3] ) ) > >> > > > > >if(!isset($argv[1],$argv[2],$argv[3])) // Bit shorter ;) > >> > >> But a bit harder to recognize IMO. :-) > >> > >> Cheers, > >> > >> tedd > >> -- > > > >But less confusing :) > > Perhaps for you boy wonder, but for us old farts (or at least me) > it's a bit more confusing. > > I'm going to show my ignorance now -- if I see this: > > if( !isset( $argv[1] ) || !isset( $argv[2] ) || !isset( $argv[3] ) ) > > or this > > if( !isset( $argv[1] ) && !isset( $argv[2] ) && !isset( $argv[3] ) ) > > Then I understand what that means. > > But, if I see this: > > if(!isset($argv[1],$argv[2],$argv[3]))) > > My first thought is "Is this OR or AND"? And my second thought is "If > this is OR, then what's AND?" > > Being dyslexic I'm easily confused that way (seriously, that's the > reason I never use an else-if). > > Cheers, > > tedd Well, actually, if(!isset($argv[1],$argv[2],$argv[3]))) is AND. As it is the same as this: if( ! ( isset($argv[1]) && isset($argv[2]) && isset($argv[3]) ) ) Which most of us write if (!isset($argv[1]) || !isset($argv[2]) || !isset($argv[3])) All three have the same result ;) Tijnema -- Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

« previous php.general (#260758) next »