×
Home About Us Products Services News Free Scripts Contact
news php scripts and software

PHP example - How to remove the file extension from a file name using PHP?


PHP - How to remove the file extension from a file name using PHP?

function RemoveExtension($strName) 
{ 
     $ext = strrchr($strName, '.'); 

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

$Name = 'file.txt'; 

echo RemoveExtension($filename);

Category: PHP

 
<< Go back