note 97202 added to tutorial.useful

From: Date: Thu, 08 Apr 2010 08:30:18 +0000
Subject: note 97202 added to tutorial.useful
Groups: php.notes 
Request: Send a blank email to php-notes+get-168004@lists.php.net to get a copy of this message
In the if-else statement used above, you could shorten it a bunch. Example: <?php if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) { echo 'You are using Internet Explorer.<br />'; } else { echo 'You are not using Internet Explorer.<br />'; } ?> Could instead be... <?php echo $msg = (!strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) ? 'You are <b>not</b> using IE.' : 'You are using IE.'; ?> If strpos() returns false, echo out that they are not using IE. Else, tell them they are using IE. ---- Server IP: 69.147.83.197 Probable Submitter: 71.198.203.47 ---- Manual Page -- http://www.php.net/manual/en/tutorial.useful.php Edit -- https://master.php.net/note/edit/97202 Del: integrated -- https://master.php.net/note/delete/97202/integrated Del: useless -- https://master.php.net/note/delete/97202/useless Del: bad code -- https://master.php.net/note/delete/97202/bad+code Del: spam -- https://master.php.net/note/delete/97202/spam Del: non-english -- https://master.php.net/note/delete/97202/non-english Del: in docs -- https://master.php.net/note/delete/97202/in+docs Del: other reasons-- https://master.php.net/note/delete/97202 Reject -- https://master.php.net/note/reject/97202 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#168004) next »