Image

Imagematchboy wrote in Imagephp_dev 😊grateful

Listens: Mira - Even Now

quick question about a function for strings/arrays

I'm trying to find a function that will check on a string and split it apart into an array on the LAST decimal in the string. The following code is checking on the file extension of a string and was just splitting on the decimal. This worked fine until users would submit files with multiple decimals. Is there a RIGHT type function that will just pull the right 3 letters of a string so I can check on that value? or a way to just find the righter most decimal and break the string into an array there?

thanks in advance...





{
$extSplitArray = split("\.", $a_row[2]);
$tmpExtension = $extSplitArray[1];

print "<tr bgcolor=\"#FFFFDF\"><td colspan=2><a target=\"_blank\" href=\"$localPath/files/$a_row[2]\">\n";

if(strtoupper($extSplitArray[1])=="DOC"){print"<img src=\"images/phpFileCabinet/ico_word.jpg\" border=\"0\">\n";}

elseif(strtoupper($extSplitArray[1])=="XLS"){print"<img src=\"images/phpFileCabinet/ico_excel.jpg\" border=\"0\">\n";}

elseif(strtoupper($extSplitArray[1])=="PDF"){print"<img src=\"images/phpFileCabinet/ico_pdf.jpg\" border=\"0\">\n";}

elseif(strtoupper($extSplitArray[1])=="PPT"){print"<img src=\"images/phpFileCabinet/ico_ppt.jpg\" border=\"0\">\n";}

else{print"<img src=\"images/file.gif\" border=\"0\">\n";}

print "$a_row[1]</a>\n";

if($a_row[3]<>null or $a_row[3]<>""){print " - $a_row[3]\n";}

print "</td>\n";
}