note 46737 added to language.control-structures

From: Date: Thu, 21 Oct 2004 20:19:34 +0000
Subject: note 46737 added to language.control-structures
Groups: php.notes 
Request: Send a blank email to php-notes+get-78902@lists.php.net to get a copy of this message
if you want to have two expressions you can use any logical operators 'and', 'or' <?php if ($num > 10 and $num < 15) { echo "number is greater than 10 but less than 15"; } ?> another way, you can enclose each expression into open/close parentheses - ( expression1 ) and (expression2) so that its easy to analyze your expressions <?php if ( ($num > 10) and ($num < 15) ) { echo "number is greater than 10 but less than 15"; } ?> i prefer using the wordings 'and' instead of '&&' operator because wordings operators are easy to analyze and easy to your eye to read especially for long expressions. the '&&' tends to be confused to $ sign ---- Manual Page -- http://www.php.net/manual/en/language.control-structures.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46737 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46737&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46737&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46737&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46737&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46737&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46737&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+46737&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#78902) next »