Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > a34ed6838d4b29d38abd504392a4a797 > files > 667

php-manual-es-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>fnmatch</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Manual de PHP"
HREF="index.html"><LINK
REL="UP"
TITLE="Funciones del sistema de ficheros"
HREF="ref.filesystem.html"><LINK
REL="PREVIOUS"
TITLE="flock"
HREF="function.flock.html"><LINK
REL="NEXT"
TITLE="fopen"
HREF="function.fopen.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Manual de PHP</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.flock.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.fopen.html"
ACCESSKEY="N"
>Siguiente</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.fnmatch"
></A
>fnmatch</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN19485"
></A
><P
>    (PHP 4 &#62;= 4.3.0)</P
>fnmatch&nbsp;--&nbsp;Match filename against a  pattern</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN19488"
></A
><H2
>Description</H2
>array <B
CLASS="methodname"
>fnmatch</B
> ( string pattern, string string [, int flags])<BR
></BR
><P
>&#13;     <B
CLASS="function"
>fnmatch()</B
> checks if the passed <TT
CLASS="parameter"
><I
>string</I
></TT
> would 
     match the given shell wildcard <TT
CLASS="parameter"
><I
>pattern</I
></TT
>.
    </P
><P
>&#13;     This is especialy usefull for filenames, but may also be used on regular strings.
     The average user may be used to shell patterns or at least in their simplest form
     to <TT
CLASS="literal"
>'?'</TT
> and <TT
CLASS="literal"
>'*'</TT
> wildcards so using 
     <B
CLASS="function"
>fnmatch()</B
> instead of <A
HREF="function.ereg.html"
><B
CLASS="function"
>ereg()</B
></A
> or 
     <A
HREF="function.preg-match.html"
><B
CLASS="function"
>preg_match()</B
></A
> for frontend search expression input may be
     way more convenient for non-programming users.
    </P
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN19512"
></A
><P
><B
>Ejemplo 1. 
      Checking a color name against a shell wildcard pattern.
     </B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>if(fnmatch("*gr[ae]y", $color)) {
  echo "some form of gray ...";
}</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
><P
>&#13;     See also <A
HREF="function.glob.html"
><B
CLASS="function"
>glob()</B
></A
>,
     <A
HREF="function.ereg.html"
><B
CLASS="function"
>ereg()</B
></A
>,
     <A
HREF="function.preg-match.html"
><B
CLASS="function"
>preg_match()</B
></A
> 
     and the unix manpage on <TT
CLASS="literal"
>fnmatch(3)</TT
> for flag names
     (as long as they are not documented here ).
    </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.flock.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Inicio</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.fopen.html"
ACCESSKEY="N"
>Siguiente</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>flock</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.filesystem.html"
ACCESSKEY="U"
>Subir</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>fopen</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>