(PHP 4 >= 4.3.0, PHP 5, PHP 7)
fnmatch — ��ģʽƥ���ļ���
$pattern
, string $string
[, int $flags
= 0
] ) : bool
fnmatch()
��鴫���
string
�Ƿ�ƥ������� shell ͳ���
pattern
��
pattern
shell ͳ�����
string
Ҫ�����ַ����� �˺��������ļ����������ã���Ҳ����������ͨ���ַ�����
��ͨ�û�����ϰ���� shell ģʽ�����������������ʽ '?' �� '*' ͨ��������ʹ�� fnmatch() ������ preg_match() ������ǰ���������ʽ������ڷdz���Ա�û����ӷ��㡣
flags
The value of flags
can be any combination of
the following flags, joined with the
binary OR (|) operator.
Flag |
Description |
---|---|
FNM_NOESCAPE |
Disable backslash escaping. |
FNM_PATHNAME |
Slash in string only matches slash in the given pattern. |
FNM_PERIOD |
Leading period in string must be exactly matched by period in the given pattern. |
FNM_CASEFOLD |
Caseless match. Part of the GNU extension. |
ƥ���� TRUE
������ FALSE
��
�汾 | ˵�� |
---|---|
5.3.0 | �˺�����ʼ�� Windows ƽ̨����Ч�� |
Example #1 �� shell �е�ͨ���ģʽƥ���������ɫ����
<?php
if (fnmatch("*gr[ae]y", $color)) {
echo "some form of gray ...";
}
?>
Ŀǰ�ú������� Windows �������� POSIX ���ݵ�ϵͳ��ʹ�á�