RE: Question: Simpler loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yep, Mike's solution is simpler.

It's getting late on Friday and the brain is starting to slow down.
(That's my excuse anyway...)

[snip]
> > 
> > Is there a simpler way / shorter way to check
> > conditions to do this ?
> 
> So, the entry is valid only if all three are non-blank?
> 
> In which case:
> 
>    if ($skill!='' && $skys[$key]!='' && $slus[$key] !='')
>    {
>       // row is valid -- do stuff
>    }
>    else
>    {
>       // entry has at least one value blank -- issue error
>    }
> 
> If you prefer to have the error path come first, simply apply deMorgan's
> laws to the Boolean expression, to get:
> 
>    if ($skills=='' || $skys[$key]=='' || $slus[$key]=='')
>    {
>       // entry has at least one value blank -- issue error
>    }
>    else
>    {
>       // row is valid -- do stuff
>    }
> 
> Cheers!
> 
> Mike
> 
[snip]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux