Req #69384 [Opn->Sus]: Add glob_filter() function
Edit report at https://bugs.php.net/bug.php?id=69384&edit=1
ID: 69384
Updated by: cmb@php.net
Reported by: bschussek at gmail dot com
Summary: Add glob_filter() function
-Status: Open
+Status: Suspended
Type: Feature/Change Request
Package: Filesystem function related
Operating System: Ubuntu 14.04 LTS
PHP Version: 5.6.8RC1
Block user comment: N
Private report: N
New Comment:
It seems to me that it isn't hard to implement in userland, and I
don't see a real advantage doing it in C. As such, this feature
requires discussion for which this bug tracker is not suitable.
So if you, or anybody else, is still interested in this, please
forward the request to the internals mailing list. For the time
being, I'm suspending this ticket.
Previous Comments:
------------------------------------------------------------------------
[2015-04-06 13:38:31] bschussek at gmail dot com
Description:
------------
I'd love to see a glob_filter() function that filters an array of file paths for those file
paths matching a glob, with the same rules used by glob(). This function is needed when a virtual
file system (implemented in PHP) should be globbed for files.
Signature:
glob_filter(array $paths, string $glob[, int $flags = 0])
$paths - an array of file system paths
$glob - a glob
$flags - the glob() flags
Result: an array of matching file system paths
Test script:
---------------
$input = array(
'/css',
'/css/reset.css',
'/css/style.css',
'/js',
'/js/script.js',
);
foreach (glob_filter($input, '/*/*.css') as $path) {
echo $path."\n";
}
Expected result:
----------------
/css/reset.css
/css/style.css
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69384&edit=1
Thread (2 messages)