deleting file extensions
Posted: Thu Feb 05, 2004 11:20 pm
Hi,
Could anyone show me how to delete the extension off a file? This is the little bit I have now...
Could anyone show me how to delete the extension off a file? This is the little bit I have now...
Code: Select all
while(false !== ($file = readdir($dir)))
{
$sep = explode('.', $file);
//$num = count($sep);
//$ext = $split[$num - 1];
foreach($sep as $key => $value)
{
echo $value. '<br>';
}
}
As you can see, I can blow the file name up and isolate the extension but not sure what to do next. I can't believe I'm not thinking of a way to do it. Am I approaching this correctly, or should I be using some sort of regular expression, or what? Thanks in advance for any advice.
Rob