New syntax operator case
| From: | Diana Dutra | Date: | Tue, 08 Apr 2014 16:51:48 +0000 |
| Subject: | New syntax operator case | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-18734@lists.php.net to get a copy of this message | ||
Hello, I discover a syntax operator case which does not appear in the php
manual.
Out of curiosity inform them the script below:
<?php
$nome = 'Diana';
$idade = 24;
switch ($idade) {
case $idade < 16:
echo "$nome : Não pode votar";
break;
case $idade > 70 or $idade == 17 or $idade == 16:
echo "$nome : Voto Opcional";
break;
case $idade >=18 and $idade <= 70:
echo "$nome : Voto Obrigatório";
break;
case $nome == 'Diana':
echo "Nome $nome";
break;
}
?>
At,
Diana Dutra
dianadutra.sc@gmail.com
+55(48)96006332
Brazil - UF: Santa Catarina