note 100191 added to function.fnmatch

From: Date: Thu, 30 Sep 2010 04:37:17 +0000
Subject: note 100191 added to function.fnmatch
Groups: php.notes 
Request: Send a blank email to php-notes+get-172834@lists.php.net to get a copy of this message
Here's a definitive solution, which supports negative character classes <?php if (!function_exists('fnmatch')) { define('FNM_PATHNAME', 1); define('FNM_PERIOD', 4); define('FNM_NOESCAPE', 2); define('FNM_FILE_NAME', FNM_PATHNAME); define('FNM_LEADING_DIR', 8); define('FNM_CASEFOLD', 16); function fnmatch($pattern, $string) { $pattern = strtr( preg_quote($pattern, '#'), array( '\*' => '.*', '\?' => '.', '\[\!' => '[^', '\[' => '[', '\]' => ']' ) ); return (boolean)preg_match('#^' . $pattern . '$#i', $string); } } ?> ---- Server IP: 117.104.162.229 Probable Submitter: 203.144.8.51 (proxied: 203.144.8.51) ---- Manual Page -- http://www.php.net/manual/en/function.fnmatch.php Edit -- https://master.php.net/note/edit/100191 Del: integrated -- https://master.php.net/note/delete/100191/integrated Del: useless -- https://master.php.net/note/delete/100191/useless Del: bad code -- https://master.php.net/note/delete/100191/bad+code Del: spam -- https://master.php.net/note/delete/100191/spam Del: non-english -- https://master.php.net/note/delete/100191/non-english Del: in docs -- https://master.php.net/note/delete/100191/in+docs Del: other reasons-- https://master.php.net/note/delete/100191 Reject -- https://master.php.net/note/reject/100191 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#172834) next »