Re: if(($var && $var < $othervar) || (statement like first) || ( other statement))

From: Date: Thu, 15 Jun 2000 19:22:42 +0000
Subject: Re: if(($var && $var < $othervar) || (statement like first) || ( other statement))
Groups: php.general 
Request: Send a blank email to php-general+get-1993@lists.php.net to get a copy of this message
I can see how you are confused, let me try to clear things up: $a = 1; $b = 2; if ($a && $a < $b) { } What that is saying is "if $a is unequal to zero and $a is less then $b". The expression: "if ($a && $a) {" would mean "if $a is greater than zero and $a is greater than zero". Basically the following two things are identical: 1. if ($a) 2. if ($a != 0) { It is just a short hand way of doing it. So, to answer your question: -- Matthew Leverton - matthew@aeroinc.net - http://www.allegro.cc -----Original Message----- From: Lewis Bergman <lbergman@abi.tconline.net> To: php-general@lists.php.net <php-general@lists.php.net> Date: Thursday, June 15, 2000 2:06 PM Subject: [PHP-GENERAL] if(($var && $var < $othervar) || (statement like first) || ( other statement)) >Forgive me but I searched the manuals and evidently I am so far off I don't know >where to look. > >The script which is the subject of the questions to follow: > > if (($clients[$i]["views"] && $clients[$i]["views"] < $clients[$i]["views_used"]) || > ($clients[$i]["clicks"] && $clients[$i]["clicks"] < $clients[$i]["clicks_used"]) || > (isset($clients[$i]["days"]) && $clients[$i]["days"] < 0)) > { >do whatever > >Q. >1. I know what the && is for from the maual. both $a and $b are true result is >true. But what does if ($a && $a) do. It must be different because this script >I am trying to find a problem with absolutely will do nothing without it. > >2. Is the pipe " || " an or, and, continue, or what? > >This script is from mail.php3, a part of phpads. Almost everything with the >program is great but the way this statement evaluates seems to be flawed. I >have inserted tons of hooks to print out the relevent variables along the way >and a set of values which should seem to evaluate to true do not. So I must be >misunderstanding something above. > >Please someone help. I have been looking at this for 2 days and although I know >a lot more I am no closer to solving it. > >-- >-Lewis Bergman- >Texas Communications >915-695-6962 >4309 Maple St. >Abilene, TX 79602 > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net >For additional commands, e-mail: php-general-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#1993) next »