PHP : OR operator
PHP : OR operator
- Started
- Last post
- 7 Responses
- tobor
Works
-------
$poo = 'PR';
if($poo == 'CO' || $poo == 'PR'){
echo "Hooray";
}
- enobrev0
echo ($poo == 'CO' || $poo == 'PR') ? 'Hooray' : '';
- tobor0
Okay... I should have checked to see if it had written my whole questions:
Instead of this:
if($poo == 'CO' || $poo == 'PR')Could it be this:
f($poo == 'CO' || 'PR')
- ********0
nope.
- enobrev0
i concur.
- ********0
why didn't you just try it and see for yourself?
- tobor0
I did.. it didn't worked. I posted it, in case someone knew a more efficient way of writing it.
- enobrev0
$poo = 'PR';
switch ($poo) {
case 'CO':
case 'PR':
echo 'Hooray';
break;default:
// do nothing
break;
}