note 82351 added to control-structures.switch
| From: | lko at netuse dot de | Date: | Mon, 07 Apr 2008 15:51:57 +0000 |
| Subject: | note 82351 added to control-structures.switch | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138002@lists.php.net to get a copy of this message | ||
Attention if you have mixed types of value in one switch statemet it can make you some trouble
<?php
$string="2string";
switch($string)
{
case 1:
echo "this is 1";
break;
case 2:
echo "this is 2";
break;
case '2string':
echo "this is a string";
break;
}
?>
The swich-statement will halt on 'case 2'
Answer: this is 2
----
Server IP: 212.124.37.9
Probable Submitter: 195.244.232.34
----
Manual Page -- http://www.php.net/manual/en/control-structures.switch.php
Edit -- https://master.php.net/note/edit/82351
Del: integrated -- https://master.php.net/note/delete/82351/integrated
Del: useless -- https://master.php.net/note/delete/82351/useless
Del: bad code -- https://master.php.net/note/delete/82351/bad+code
Del: spam -- https://master.php.net/note/delete/82351/spam
Del: non-english -- https://master.php.net/note/delete/82351/non-english
Del: in docs -- https://master.php.net/note/delete/82351/in+docs
Del: other reasons-- https://master.php.net/note/delete/82351
Reject -- https://master.php.net/note/reject/82351
Search -- https://master.php.net/manage/user-notes.php