note 124079 added to function.scandir

From: Date: Mon, 29 Jul 2019 12:58:07 +0000
Subject: note 124079 added to function.scandir
Groups: php.notes 
Request: Send a blank email to php-notes+get-211754@lists.php.net to get a copy of this message
If you use array_diff() to eliminate "." and ".." you must use array_values() on the result because array_diff() will return an associative array, which may cause problems for a for loop beginning at 0. $files = array_values(array_diff(scandir($directory), array('..', '.'))); ---- Server IP: 208.43.231.9 Probable Submitter: 82.199.157.54 (proxied: 97.73.16.11) ---- Manual Page -- http://php.net/manual/en/function.scandir.php Edit -- https://master.php.net/note/edit/124079 Del: integrated -- https://master.php.net/note/delete/124079/integrated Del: useless -- https://master.php.net/note/delete/124079/useless Del: bad code -- https://master.php.net/note/delete/124079/bad+code Del: spam -- https://master.php.net/note/delete/124079/spam Del: non-english -- https://master.php.net/note/delete/124079/non-english Del: in docs -- https://master.php.net/note/delete/124079/in+docs Del: other reasons-- https://master.php.net/note/delete/124079 Reject -- https://master.php.net/note/reject/124079 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#211754) next »