note 82351 deleted from control-structures.switch by crell
| From: | crell@php.net | Date: | Mon, 27 Jun 2022 21:55:12 +0000 |
| Subject: | note 82351 deleted from control-structures.switch by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218653@lists.php.net to get a copy of this message | ||
Note Submitter: lko at netuse dot de
----
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