note 79489 added to function.fnmatch

From: Date: Thu, 29 Nov 2007 18:31:32 +0000
Subject: note 79489 added to function.fnmatch
Groups: php.notes 
Request: Send a blank email to php-notes+get-132669@lists.php.net to get a copy of this message
About the windows compat functions below: I needed fnmatch for a application that had to work on Windows, took a look here and tested both. Jk's works for me, soywiz didn't (on WinXPSP2, PHP 5.2.3). The only difference between them is addcslashes (soywiz) instead of preg_quote (jk). They _should_ both work, but for some reason soywiz's didn't for me. So YMMV. However, to make JK's fnmatch() work with the example in the documentation, you also have to strtr the [ and ] in $pattern. <?php $pattern = strtr(preg_quote($pattern, '#'), array('\*' => '.*', '\?' => '.', '\[' => '[', '\]' => ']')); ?> And thanks for the functions, guys. ---- Server IP: 213.249.64.162 Probable Submitter: 82.170.236.2 ---- Manual Page -- http://www.php.net/manual/en/function.fnmatch.php Edit -- https://master.php.net/note/edit/79489 Del: integrated -- https://master.php.net/note/delete/79489/integrated Del: useless -- https://master.php.net/note/delete/79489/useless Del: bad code -- https://master.php.net/note/delete/79489/bad+code Del: spam -- https://master.php.net/note/delete/79489/spam Del: non-english -- https://master.php.net/note/delete/79489/non-english Del: in docs -- https://master.php.net/note/delete/79489/in+docs Del: other reasons-- https://master.php.net/note/delete/79489 Reject -- https://master.php.net/note/reject/79489 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#132669) next »