
fnmatch()函数将文件名或字符串与指定的模式匹配。
语法
bool fnmatch ( string $pattern , string $string [, int $flags = 0 ] )
fnmatch()函数可以检查传递的字符串是否与给定的shell通配符模式匹配,并且此函数尚未在Windows平台上实现。
在线示例
<?php
   $color = "phpcodez.txt";
   if(fnmatch("*phpcode[zs].txt", $color)) {
      echo "phpcodez";
   } else {
      echo "Color not found!";
   }
?>输出结果
phpcodez
