, . , . , .
:
function test($name)
{
echo "${name}: ";
check_name($name);
echo "\n";
}
test(" ZZ1");
test("123");
test("4aa");
test("AAA");
test("Z11");
test("ZZ ");
test("ZZZ");
test("aaa");
test("zzz");
test("Ábc");
...
% ./test.php
ZZ1: No match
123: No match
4aa: No match
AAA: Match
Z11: Match
ZZ : Match
ZZZ: Match
aaa: Match
zzz: Match
Ábc: No match
% php --version
PHP 5.3.4 (cli) (built: Dec 15 2010 12:15:07)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
$name :
$name = $this->pattern_check($pat, $name);
if($name) {
:
$matched = $this->pattern_check($pat, $name);
if ($matched) {