Page 1 of 1

help how to check if a variable can be found inside an array

Posted: Wed Sep 21, 2005 10:13 pm
by x

Code: Select all

if ($var1==$orient_array['border']['0'] || $orient_array['border']['1'])
i dont know why this code wont work, the array($orient_array[border])has values that spans from 1-19 but doing this kind of if statement results to true even if i change it to !=. can anyone help me? :oops:

Posted: Wed Sep 21, 2005 10:19 pm
by s.dot
use in_array

Code: Select all

if(in_array($somevaluetosearchinthearray, $arrayofvalues))
{
   //
} ELSE
{
  //
}

Posted: Wed Sep 21, 2005 10:27 pm
by x
it worked, thanks a bunch Master! im sorry if i had to post this simple question im just running out of time to fix this thing im doing. wont let it happen again!! :D