Tuesday, July 14

Remove Extension PHP

I'm using a Joomla module called JX List Files. Simple, nice little module to list files in a directory. My only complaint was that it left the file extension in the name, so I added this little function I found.

function remext($strName){
$ext = strchr($strName, '.');
if($ext !== false){
$strName = substr($strName, 0, -strlen($ext));
}
return $strName;
}

No comments: