note 102388 added to function.array-search
[email protected] Fri, 11 Feb 2011 03:23:58 -0800
| Newsgroups | php.notes |
|---|---|
| Message-ID | <[email protected]> |
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