PDA

For continued disscussion on this topic : Or & And



Almosamem
05-25-2001, 11:25 AM
In the name of Allah

how I can use the:


OR and AND

on php ?

in past in PASCAL I used it like:



If (A = 5 ) or (B = 5) do


but on php language HOW I CAN USE IT?

voicebox
05-25-2001, 12:19 PM
Hi Almosamem,

To do "or" in PHP (and many modern languages) you use the || operator, and to compare two values use == not =. The code would look like this:
if (($a == 5) || ($b == 5)) {

Almosamem
05-25-2001, 12:29 PM
Thank u voicebox

rick
05-25-2001, 09:53 PM
you can also use the words 'and' & 'or' just like you used in your example. As far as I know they work exactly like || and &&