Menu
Newbie question: I have a small snipet of code here
$filetype_img = array(“gif”, “jpg”, “jpeg”, “png”, “bmp”, “psd”, “psp”, “tif”);
if(in_array ($fileext, $filetype_img))
{
$filemime = “Image”;
$file_image = $icon_image;
}
The above code works great if it not in a function. Below throws the Warning: in_array() [function.in-array]: Wrong datatype for second argument
function getfileext($fileext){
if(in_array ($fileext, $filetype_img)){
$filemime = “Image”;
$file_image = $icon_image;
}
}
getfileext($ext); // $ext is a string value