How do I ask if a variable is equivalent to any member of an array? Seems like something like IMPLODE should work.
example:
if ($id == $id_cat1[0], $id_cat1[1] ETC. ){ $checked="checked"; }else{ $checked=""; }
thanks
Using a for loop is a solution: //================= $checked = 0;
for ($i = 0; $i<=$id_cat1.count()-1; $i++) { if ($id == $id_cat1[$i]) { $checked++; } }
//the variable $checked is equivalent to the number of values in the array equal to $id.
If you are using PHP4 ypu can use in_array() function like this (From the manual )
$os = array ("Mac", "NT", "Irix", "Linux");
if (in_array ("Irix", $os)) print "Got Irix";