note 102388 added to function.array-search

From: Date: Fri, 11 Feb 2011 11:23:58 +0000
Subject: note 102388 added to function.array-search
Groups: php.notes 
Request: Send a blank email to php-notes+get-176891@lists.php.net to get a copy of this message
I found a simple script to remove certain values from a array. I use it when using the scandir function, because i don't want certain items in the array (like the ., .. folders and the thumbs.db) <?php $music = scandir("music"); unset($music[array_search('.',$music)]); // Removing the . directory unset($music[array_search('..',$music)]); // Removing the .. directory unset($music[array_search('Thumbs.db',$music)]); // Removing the Thumbs.db file unset($music[array_search('thumbs.db',$music)]); // Removing the thumbs.db file ?> ---- Server IP: 69.147.83.197 Probable Submitter: 89.146.29.251 ---- Manual Page -- http://www.php.net/manual/en/function.array-search.php Edit -- https://master.php.net/note/edit/102388 Del: integrated -- https://master.php.net/note/delete/102388/integrated Del: useless -- https://master.php.net/note/delete/102388/useless Del: bad code -- https://master.php.net/note/delete/102388/bad+code Del: spam -- https://master.php.net/note/delete/102388/spam Del: non-english -- https://master.php.net/note/delete/102388/non-english Del: in docs -- https://master.php.net/note/delete/102388/in+docs Del: other reasons-- https://master.php.net/note/delete/102388 Reject -- https://master.php.net/note/reject/102388 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#176891) next »