PHP Function Fnmatch
php function fnmatch is an important function used for a variety of tasks including filtering file names and validating input. It allows us to match strings against patterns using shell-style wildcards. In this article, we'll walk through the syntax and some examples to help you get started with this handy function.
The fnmatch() function checks whether the passed string would match a given shell wildcard pattern and returns True if it does, or False if not. It has three parameters: pattern, string and flags. Flags can be any combination of the following bitwise flags joined together with the binary OR (|) operator:
The patterns and strings are matched in an alphabetical order, so that
The fnmatch() function has an option to disable the use of '?' and '[