X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

PHP fnmatch() Function


PHP Filesystem Reference Complete PHP Filesystem Reference

Definition and Usage

The fnmatch() function matches a filename or string against the specified pattern.

Syntax

fnmatch(pattern,string,flags)

Parameter Description
pattern Required. Specifies the pattern to search for
string Required. Specifies the string or file check
flags Optional.


Tips and Notes

Note: This function is not implemented on Windows platforms.


Example

Checking a color name against a shell wildcard pattern:

<?php
$txt = "My car is darkgrey..."
if (fnmatch("*gr[ae]y",$txt))
  {
  echo "some form of gray ...";
  }
?>


PHP Filesystem Reference Complete PHP Filesystem Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook