note 108902 modified in language.expressions by danbrown
| From: | danbrown@php.net | Date: | Sun, 03 Jun 2012 15:35:45 +0000 |
| Subject: | note 108902 modified in language.expressions by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-188386@lists.php.net to get a copy of this message | ||
About the multiply (star) character: Note that if you try to use the
'*' in a comparaison you will have many
results... <?php $a =
'*'; switch($a) { case 1: echo
' (int)one'; case 0: echo '
(int)zero'; case '0': echo '
(string)zero'; case '*': echo '
(string)star'; case true: echo '
(bool)true'; case false: echo '
(bool)false'; } // ouput // (int)zero
(string)zero (string)star (bool)true (bool)false ?>
--was--
About the multiply (star) character:
Note that if you try to use the '*' in a comparaison you will have many results...
$a = '*';
switch($a)
{
case 1: echo ' (int)one';
case 0: echo ' (int)zero';
case '0': echo ' (string)zero';
case '*': echo ' (string)star';
case true: echo ' (bool)true';
case false: echo ' (bool)false';
}
// ouput
// (int)zero (string)zero (string)star (bool)true (bool)false
http://php.net/manual/en/language.expressions.php