note 42430 deleted from function.glob by tomsommer

From: Date: Mon, 17 May 2004 06:29:45 +0000
Subject: note 42430 deleted from function.glob by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-69686@lists.php.net to get a copy of this message
Note Submitter: p[NO]mat[SPAM]ias[@]bol[.]com[.]br ---- Yet another glob function =) <?php function glob($pattern) { $parts = pathinfo($pattern); $pattern = '/^' . str_replace( array('\\*', '\\?', '\\[', '\\]'), array('.*', '.', '[', ']'), preg_quote($parts['basename'])) . '$/'; $dir = opendir($parts['dirname']); if(!is_resource($dir)) return (array)null; while($file = readdir($dir)) { if(($file == '.') || ($file == '..')) continue; if(preg_match($pattern, $file)) $files[] = "{$parts['dirname']}/$file"; } closedir($dir); if(isset($files)) return $files; return (array)null; } ?>

« previous php.notes (#69686) next »