PHP - Funktion fnmatch()
❮ Referenz zum PHP-DateisystemBeispiel
Überprüfen eines Farbnamens anhand eines Shell-Platzhaltermusters:
<?php
$txt = "My car is a dark color";
if (fnmatch("*col[ou]r",$txt))
{
echo "hmm...";
}
?>
Definition und Verwendung
Die Funktion fnmatch() prüft, ob ein String oder Dateiname mit dem angegebenen Shell-Wildcard-Muster übereinstimmt.
Syntax
fnmatch(pattern, string, flags)
Parameterwerte
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
Rückgabewert: | TRUE bei Erfolg, FALSE bei Misserfolg |
---|---|
PHP-Version: | 4.3+ |
PHP-Änderungsprotokoll: | PHP 5.3: Jetzt auf Windows-Plattformen verfügbar |
❮ Referenz zum PHP-Dateisystem