Re: preg_match problem
| From: | Jochem Maas | Date: | Mon, 21 Aug 2006 19:39:46 +0000 |
| Subject: | Re: preg_match problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-240968@lists.php.net to get a copy of this message | ||
function doMatch($f) {
echo $f,
" = ",
(preg_match("#^form[1-6]\.php\$#",basename($f))?"true":"false"),
"\n";
}
doMatch("form1.php"); // true
doMatch("form2.php"); // true
doMatch("form3.php"); // true
doMatch("form4.php"); // true
doMatch("form5.php"); // true
doMatch("form6.php"); // true
doMatch("/some/dir/form6.php"); // true
doMatch("form06.php"); // false
doMatch("/some/dir/form06.php");// false
doMatch("form16.php"); // false
doMatch("/some/dir/form16.php");// false
afan@afan.net wrote:
> hi.
>
> I have to check if the script file belongs to any ov form1.php to
> form6.php files. Need something like:
> preg_match('/form*.php/', $_SERVER['PHP_SELF'])
> wher * kan be any number between 1 and 6.
>
> Thanks for any help.
>
> -afan
>