What I am doing wrong with the following code? I want to compare if the element $my_id
is present within the array $arr
. If it is present return TRUE
else return FALSE
.
for($i=0;$i<$cnt;$i++)
{
if($arr[$i] == $my_id)
{
return TRUE;
}
else
{
return FALSE;
}
}