note 112651 added to control-structures.switch

From: Date: Tue, 09 Jul 2013 13:12:18 +0000
Subject: note 112651 added to control-structures.switch
Groups: php.notes 
Request: Send a blank email to php-notes+get-195545@lists.php.net to get a copy of this message
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; } ?> ---- Server IP: 69.147.83.199 Probable Submitter: 41.206.11.26 ---- Manual Page -- http://php.net/manual/en/control-structures.switch.php Edit -- https://master.php.net/note/edit/112651 Del: integrated -- https://master.php.net/note/delete/112651/integrated Del: useless -- https://master.php.net/note/delete/112651/useless Del: bad code -- https://master.php.net/note/delete/112651/bad+code Del: spam -- https://master.php.net/note/delete/112651/spam Del: non-english -- https://master.php.net/note/delete/112651/non-english Del: in docs -- https://master.php.net/note/delete/112651/in+docs Del: other reasons-- https://master.php.net/note/delete/112651 Reject -- https://master.php.net/note/reject/112651 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#195545) next »