note 117575 added to function.scandir

From: Date: Wed, 01 Jul 2015 14:12:16 +0000
Subject: note 117575 added to function.scandir
Groups: php.notes 
Request: Send a blank email to php-notes+get-203010@lists.php.net to get a copy of this message
I was looking for an easy way to get only files from a certain directory. I came up with the following line of code that will result in an array listing only files. the samen can be done for directories ofcourse. <?php $files = array_filter(scandir($directory), function($file) { return is_file($file); }) ?> ---- Server IP: 72.52.91.14 Probable Submitter: 80.113.17.58 ---- Manual Page -- http://php.net/manual/en/function.scandir.php Edit -- https://master.php.net/note/edit/117575 Del: integrated -- https://master.php.net/note/delete/117575/integrated Del: useless -- https://master.php.net/note/delete/117575/useless Del: bad code -- https://master.php.net/note/delete/117575/bad+code Del: spam -- https://master.php.net/note/delete/117575/spam Del: non-english -- https://master.php.net/note/delete/117575/non-english Del: in docs -- https://master.php.net/note/delete/117575/in+docs Del: other reasons-- https://master.php.net/note/delete/117575 Reject -- https://master.php.net/note/reject/117575 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#203010) next »