note 75559 added to function.basename

From: Date: Tue, 05 Jun 2007 14:21:49 +0000
Subject: note 75559 added to function.basename
Groups: php.notes 
Request: Send a blank email to php-notes+get-127231@lists.php.net to get a copy of this message
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(); ---- Server IP: 64.71.164.2 Probable Submitter: 24.250.21.79 ---- Manual Page -- http://www.php.net/manual/en/function.basename.php Edit -- https://master.php.net/note/edit/75559 Del: integrated -- https://master.php.net/note/delete/75559/integrated Del: useless -- https://master.php.net/note/delete/75559/useless Del: bad code -- https://master.php.net/note/delete/75559/bad+code Del: spam -- https://master.php.net/note/delete/75559/spam Del: non-english -- https://master.php.net/note/delete/75559/non-english Del: in docs -- https://master.php.net/note/delete/75559/in+docs Del: other reasons-- https://master.php.net/note/delete/75559 Reject -- https://master.php.net/note/reject/75559 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#127231) next »