i have a directory read program and i dont want to display txt files in listing. I am using rtrim function, like this:
rtrim($files[$i], "text1.txt")
this only works in one textfile and i would like to get rid of them all!
if your definition of a text file is that it has an txt extension, i.e. <anyfilename>.txt is the text files you want to avoid in the listing:
foreach($files as $filename) { if(!strcasecmp(substr($filename, -4), '.txt')) { // Perform your display here like echo $filename; } }