Get 1st array value seperately

Some older versions of PHP don't seem to like calling [0] on the same
line as explode
Now getting value on seperate line of code
This commit is contained in:
Matt Pass
2013-06-04 14:14:49 +01:00
parent ad8c3da48b
commit 24d68efd4b

View File

@@ -30,7 +30,8 @@ if ($_GET['action']=="load") {
$finfo = finfo_file($finfoMIME, $file);
finfo_close($finfoMIME);
} else {
$fileExt = explode(" ",pathinfo($file, PATHINFO_EXTENSION))[0];
$fileExt = explode(" ",pathinfo($file, PATHINFO_EXTENSION));
$fileExt = $fileExt[0];
if (array_search($fileExt,array("coffee","css","htm","html","js","less","md","php","py","rb","ruby","txt","xml"))!==false) {$finfo = "text";};
if (array_search($fileExt,array("gif","jpg","jpeg","png"))!==false) {$finfo = "image";};
}