I have this for a var_dump($productId):
string(1) "9"
string(2) "11"
string(2) "12"
string(2) "17"
string(2) "18"
Now, i want for example the function_x to not execute for id 18 and 17, so i want to make something like this:
$test=array('18','17');
if(!in_array($test,array($productId))){}
but seems not to be working, the idea is if i want to make for just 18 then:
$test=18;
if($test != $productId){}
and this is working, but how to do it for more than one number/ID ?
Thanks in advance!
I think the other answers are assuming your
$productIdis an array. I’m guessing you are running var_dump() inside a foreach or something.