note 75559 deleted from function.basename by bjori
| From: | bjori@php.net | Date: | Sun, 17 Jun 2007 19:35:57 +0000 |
| Subject: | note 75559 deleted from function.basename by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-127506@lists.php.net to get a copy of this message | ||
Note Submitter: cf at chronofish dot com
----
Here is an easy trick for getting a dir listing of files with a specific suffix. The example below
will list all the ".php" files in the directory defined by "DIR_PATH".
$d = dir(DIR_PATH);
while (false !== ($entry = $d->read()))
if (basename($entry, ".php").".php" == $entry)
{
print basename($entry)."<br>";
}
$d->close();