rgb192
asked on
if $variable !=('term1','term2','term3')
if $variable !=('term1','term2','term3' )
is this the correct syntax
is this the correct syntax
if ($variable != 'term1' || $variable != 'term2' || $variable != 'term3') {
//
}
|| is or
&& is and
//
}
|| is or
&& is and
ASKER
i have 100 terms
can I do a list or array
can I do a list or array
$array = array(
'term1',
'term2',
);
if (! in_array($variable, $array)) {
//
}
$a = array('1.10', 12.4, 1.13);
if (in_array('12.4', $a, true)) {
echo "'12.4' found with strict check\n";
}
http://php.net/manual/en/function.in-array.php
if (in_array('12.4', $a, true)) {
echo "'12.4' found with strict check\n";
}
http://php.net/manual/en/function.in-array.php
will go with enachemc, +1 for this...
ASKER
is there a way to do a for loop
because I would have to repeat myself in the if...
because I would have to repeat myself in the if...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks
Open in new window