Reply to Re: Switch isset and $_get

Your name:

Reply:


Posted by Jerry Stuckle on 10/23/06 00:35

Pedro Graca wrote:
> Juliette wrote:
>
>>Pedro Graca wrote:
>>
>>>When there is no match for the case expressions and there are several
>>>`default` cases (illegal in C too), the one chosen seems to be the last
>>>and not, as I expected, the first.
>>
>>No matter what, having several 'default:' cases is *always* highly
>>inadvisable.
>
>
> SCNR
> Having several `case CONSTANT:` with the same CONSTANT is ok? :)
>
>
> <?php
> $var = true;
>
> echo "First set: ";
> switch ($var) {
> default: echo 'No variables in the list are'; break;
> case isset($a): echo 'a is'; break;
> case isset($b): echo 'b is'; break;
> case isset($c): echo 'c is'; break;
> case isset($d): echo 'd is'; break;
> }
> echo " set.\n";
>
> $b = $c = 42;
> echo "Second set: ";
> switch ($var) {
> default: echo 'No variables in the list are'; break;
> case isset($a): echo 'a is'; break;
> case isset($b): echo 'b is'; break;
> case isset($c): echo 'c is'; break;
> case isset($d): echo 'd is'; break;
> }
> echo " set.\n";
> ?>
>
> To the Original Poster: don't use this code!
>

Well, it doesn't give an error, but it's operation is specified. So I
suspect if how it works changes you won't be able to do ant hying about it.

The bottom line is - the only defined behavior is to have a single
instance of a specific CONSTANT and a single default.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация