And/Or
Posted: Sun Jul 01, 2007 12:31 pm
How can you do a if statement using and/or any simple way like &| ?
How would you do this:
If $cart = 2 and/or $user = 4
How would you do this:
If $cart = 2 and/or $user = 4
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
I meant doing them together. is there any simpler way to do if x==y and r==2 and/or 4kaszu wrote:http://www.php.net/manual/en/language.operators.php
If ($cart == 2 && $user = 4)
If ($cart == 2 || $user = 4)
Code: Select all
(($x==$y) && (($r==2 || $r==4)))Code: Select all
if ($x == $y && ($r == 2 || $r == 4)) {}
if ($x == $y && in_array($r, array(2,4))) {}Code: Select all
$x == $y and $r == 2 || $r == 4Hehe although mine seems to have disappeared?feyd wrote:Same result as what idevlin wrote.Code: Select all
$x == $y and $r == 2 || $r == 4