PHP fnmatch()関数
❮PHPファイルシステムリファレンス例
シェルのワイルドカードパターンに対して色の名前を確認する:
<?php
$txt = "My car is a dark color";
if (fnmatch("*col[ou]r",$txt))
{
echo "hmm...";
}
?>
定義と使用法
fnmatch()関数は、文字列またはファイル名が指定されたシェルワイルドカードパターンと一致するかどうかを確認します。
構文
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:
|
技術的な詳細
戻り値: | 成功した場合はTRUE、失敗した場合はFALSE |
---|---|
PHPバージョン: | 4.3+ |
PHP変更ログ: | PHP 5.3:Windowsプラットフォームで利用可能になりました |
❮PHPファイルシステムリファレンス