note 112532 added to function.unlink
| From: | Alex | Date: | Wed, 26 Jun 2013 16:22:35 +0000 |
| Subject: | note 112532 added to function.unlink | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-195366@lists.php.net to get a copy of this message | ||
The best way to delete files by mask is as follows:
<?php
array_walk(glob('/etc/*'), 'unlink');
?>
Do not use array_map mentioned below - it's purpose is to process values in a given array AND
COLLECT data returned by the callback function. So, array_map is slower and uses additional memory
compared to array_walk.
----
Server IP: 69.147.83.199
Probable Submitter: 82.179.218.138
----
Manual Page -- http://php.net/manual/en/function.unlink.php
Edit -- https://master.php.net/note/edit/112532
Del: integrated -- https://master.php.net/note/delete/112532/integrated
Del: useless -- https://master.php.net/note/delete/112532/useless
Del: bad code -- https://master.php.net/note/delete/112532/bad+code
Del: spam -- https://master.php.net/note/delete/112532/spam
Del: non-english -- https://master.php.net/note/delete/112532/non-english
Del: in docs -- https://master.php.net/note/delete/112532/in+docs
Del: other reasons-- https://master.php.net/note/delete/112532
Reject -- https://master.php.net/note/reject/112532
Search -- https://master.php.net/manage/user-notes.php