2009/5/5 tedd <[email protected]>:
> At 10:13 AM -0400 5/5/09, Robert Cummings wrote:
>>
>> On Tue, 2009-05-05 at 10:05 -0400, Robert Cummings wrote:
>>>
>>> On Tue, 2009-05-05 at 09:49 -0400, tedd wrote:
>>> > At 2:57 PM -0400 5/4/09, Gary wrote:
>>> > >I am trying to get this to work, however it only reads the second if
>>> > >statement. I get no error messages, but as I change counties, the %
>>> stays
>>> > >the same.
>>> > >
>>> > >Can someone enlighten me, or should I be looking at switch
>>> statements?
>>> > >
>>> > >Thanks for your help.
>>> > >
>>> > >Gary
>>> >
>>> > In my opinion, never use elseif -- I've never used it. I don't see
>>> > any reason whatsoever to do so.
>>> >
>>> > In my opinion, whenever your choices exceed two, use switch.
>>>
>>> That's some of the worst advice I've ever seen.
>>
>> Just so we all know why...
>
> Yep -- just so we know why:
>
> <http://php1.net/a/if-v-switch/>
>
> It all depends upon how you use the tools at your command.
>
> My preference is still valid and I think the code is more readable. YMMV.
>
Elseif statements are not solely used to check *one* variable. So in
some situations you can't even use a switch without implementing
if/else statements inside the switch.
BTW:
EX1:
if ( $value === '0' )
{
echo 'If/ElseIf: The string value 0'."<br>";
}
EX3:
case $value === '' :
{
echo 'Switch/Case: The empty string'."<br>";
break;
}
Where is the basic difference in readability?
Ah yes, the case is missing the brackets ..make it kinda hard to read
for me. .-)
Regards
> Cheers,
>
> tedd
> --
> -------
> http://sperling.com http://ancientstones.com http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php