why did not show first value of $img by array_search()

Home / Uncategorized / why did not show first value of $img by array_search()

Question:
why did not show first value of $img by array_search()
There is $img where are 4 values. I do not know why always do not show first value of $img ($img[0]); If I changed first value then same problem. Please tell me where is the problem?
function auto_call(){
$img=array("png","jpeg","gif","jpg");
$arrt=array("txt","jpg","png","gif","jpeg");
for($j=0;$j";
}
}
}
auto_call();

//the result is:jpg
gif
jpeg


Answer:
You should use array_search() like this:if(array_search($arrt[$j],$img) !== FALSE){
From the documentation:

This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE.

Updated code:";
}
}
}
auto_call();

?>
Read more

Leave a Reply

Your email address will not be published. Required fields are marked *