Strip the extension off of a filename in PHP

Here's a useful function to strip the extension off of a filename.

if($ext !== false) {
$name = substr($name, 0, -strlen($ext));
}
return $name;

About Editor