אני בטוח שאפשרי ואני ישמח לשמוע איך לייעל את הקוד הזה:
קוד:
<?php
function checkfile($file){
$ext=explode(".", $file);
for ($i=0; ;$i++){
if (!isset($ext[$i])){
$i=$i-1;
return $ext[$i];
break; }
if ($ext[$i]==""){
return "error";
break; }}}
echo checkfile("asdasd.jpg");
?>