Re: note 8353 added to switch
| From: | J. M. Castagnetto | Date: | Thu, 07 Sep 2000 21:42:19 +0000 |
| Subject: | Re: note 8353 added to switch | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-4453@lists.php.net to get a copy of this message | ||
This statement is incorrect. Tried the following
simple code:
<?php
for ($i=0; $i<200; $i++) {
$var = 1;
switch ($var) {
default : $var2 = 100;
}
echo $var." ".$var2."\n";
}
?>
And I got 200 lines of:
1 100
...
Check if your algorithm logic is incorrect or your are
"dropping through" the cases.
(this note will be erased from the on-line manual)
--- lx@graphodata.de wrote:
> Careful when using something like this:
>
> $var = 1;
> switch ($var) {
> default : $var2 = 100;
> }
>
> which IMHO should do the same as:
>
> $var = 1;
> $var2 = 100;
>
> BUT it sometimes changes $var2 and sometimes not!
> Though this statement seems useless at first sight,
> think of a later-on expansion with different
> conditions already in mind when i coded this.
>
>
>
http://www.php.net/manual/control-structures.switch.php
>
>
>
> --
> PHP Notes Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-notes-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-notes-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
=====
--- Jesus M. Castagnetto (jcastagnetto@yahoo.com)
__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/