note 112651 deleted from control-structures.switch by mazzanet
| From: | mazzanet@php.net | Date: | Thu, 11 Jul 2013 04:54:46 +0000 |
| Subject: | note 112651 deleted from control-structures.switch by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-195568@lists.php.net to get a copy of this message | ||
Note Submitter: Patrick
----
I'm still new to php and was wondering why this code would be invalid. I could do this easily,
using an 'if' statement
<?
$email = "example@yahoo.com";
$email = trim($email);
switch ($email) {
case ereg("^.+@.\.com$", $email):
echo "Valid.";
break;
default:
echo "Invaid";
break;
}
?>