Checking a color name against a shell wildcard pattern:
<?php
$txt = "My car is a dark color";
if (fnmatch("*col[ou]r",$txt))
{
echo "hmm...";
}
?>
The fnmatch() function checks if a string or filename matches the given shell wildcard pattern.
fnmatch(
pattern,
string,
flags)
Parameter | Description |
---|---|
pattern | Required. Specifies the shell wildcard pattern |
string | Required. Specifies the string or file to check |
flags | Optional. Can be one or a combination of the following:
|
Return Value: | TRUE on success, FALSE on failure |
---|---|
PHP Version: | 4.3+ |
PHP Changelog: | PHP 5.3: Now available on Windows platforms |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!