Re: glob to take array as an arg
| From: | Peter Brodersen | Date: | Tue, 30 Aug 2005 22:09:27 +0000 |
| Subject: | Re: glob to take array as an arg | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-18585@lists.php.net to get a copy of this message | ||
On Tue, 30 Aug 2005 23:54:53 +1000, in php.internals kevin@oceania.net
(Kevin Waterson) wrote:
>I would like to make this
>
>array glob ( array patterns [, int flags] )
>
>This would tidy up much code where a series of OR's are used to match
>different patterns.
>
>$arr = array('jpg', 'gif', 'tif', 'pdf',
>'bmp', 'raw');
>foreach(glob($arr as $file)){ echo $file; }
glob is currently extremely flexible in its input with the right flags
and can expand a list. Eg:
print_r(glob("*.{jpg,gif,tif,pdf,bmp,raw}",GLOB_BRACE));
If all you want is to supply glob() with a list of full or partial
patterns I think the desired functionality is already present.
--
- Peter Brodersen