PHP fnmatch() Functie
❮ Referentie voor PHP-bestandssysteemVoorbeeld
Een kleurnaam vergelijken met een shell-jokertekenpatroon:
<?php
$txt = "My car is a dark color";
if (fnmatch("*col[ou]r",$txt))
{
echo "hmm...";
}
?>
Definitie en gebruik
De functie fnmatch() controleert of een tekenreeks of bestandsnaam overeenkomt met het opgegeven shell-jokertekenpatroon.
Syntaxis
fnmatch(pattern, string, flags)
Parameterwaarden
Parameter | Description |
---|---|
pattern | Required. Specifies the shell wildcard pattern |
string | Required. Specifies the string or file to check |
flags | Optional. Can be one or a combination of the following:
|
Technische details
Winstwaarde: | WAAR bij succes, ONWAAR bij mislukking |
---|---|
PHP-versie: | 4.3+ |
PHP-wijzigingslogboek: | PHP 5.3: Nu beschikbaar op Windows-platforms |
❮ Referentie voor PHP-bestandssysteem