Posted by guttyguppy on 10/02/05 03:48
Newbie question:
Is there any way to strip out the last four characters from the
filenames when php does a readdir? If I run the following:
<?php
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo "$file\n";
}
}
closedir($handle);
}
?>
on a folder full of .jpg files, I want $file to not grab the .jpg
extension. Hope that makes sense...
Navigation:
[Reply to this message]
|