Reply to Re: Switch isset and $_get

Your name:

Reply:


Posted by Pedro Graca on 10/23/06 00:17

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!

--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.

[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

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