PHP fnmatch()関数
完全版 PHP Filesystem リファレンスマニュアル
定義と使用法
fnmatch() 関数は、指定されたパターンに基づいてファイル名または文字列をマッチさせます。
構文
fnmatch(pattern,string,flags)
| パラメータ | 説明 |
|---|---|
| pattern | 必須。検索するパターンを指定します。 |
| string | 必須。検査する文字列またはファイルを指定します。 |
| flags | オプション。 |
ヒントと注釈
注釈:この関数は Windows プラットフォームでは使用できません。
例
シェルのワイルドカードパターンに基づいて色名をチェックします。
<?php
$txt = "My car is darkgrey..."
if (fnmatch("*gr[ae]y",$txt))
{
echo "some form of gray ...";
}
?>
$txt = "My car is darkgrey..."
if (fnmatch("*gr[ae]y",$txt))
{
echo "some form of gray ...";
}
?>
完全版 PHP Filesystem リファレンスマニュアル その他の拡張機能