- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
fnmatch() function in PHP
The fnmatch() function matches a filename or string against a specified pattern.
Syntax
fnmatch(pattern, string, flags)
Parameters
pattern − The pattern to search.
string − The string to test.
flags − Any of the following values:
FNM_NOESCAPE − Disable backslash escaping
FNM_PATHNAME − Slash in string only matches slash in the given pattern.
FNM_PERIOD − Leading period in string must be exactly matched by period in the given pattern.
Return
The fnmatch() function returns TRUE if it is a match, else FALSE.
The following is an example showing wildcard pattern.
Example
<?php $file = "organization.txt"; if (fnmatch("*organi[zs]ation",$file)) { echo "Found!"; } else { echo "Not found!"; } ?>
Output
Not found!
Advertisements