Hi, I've looked pretty hard to find more information about IF statements and how I could strip underscores/extensions etc. but I'm having trouble getting anywhere. I'm pretty new to PHP but eager to learn. Here's the code I have below, I'd like to strip underscores and extensions like .mpg from the filename, capitalize the first letter of each word and remove the first three characters of the filename. I'm pretty sure the functions I need are str_replace(), trim() and ucwords() but I can't work out how to get them into the code properly. Can anyone help me out? Here's the code. Cheers [code]<!-- display folder contents --> <?php function directory($result) { $handle=@opendir("demos"); // while ( conditional statement is true){.....do this code ;} while ($file = readdir($handle)) { // The || means 'or' and '=='' means 'is equal to' so this statement // means that IF the file has one (.) OR two (..) characters to do nothing if ($file == "." || $file == "..") { } // Otherwise... else { // print out directory link and filesize. print "<p class=\"demos\"> <a href=\"demos/$file\">$file</a><br /> (<font class=\"filesize\"><i>size: " . round(filesize("demos/$file")/1024/1024, 2) . " mb / " . round(filesize("demos/$file")/1024, 2) . " kb)</i></font></p>"; } } closedir($handle); return $result; } echo directory($result); ?>[/code]