Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 0afeee9cca140e167a996902b9a677c5 > files > 106

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

<HTML
><HEAD
><TITLE
>array_search</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="Array Functions"
HREF="ref.array.html"><LINK
REL="PREVIOUS"
TITLE="array_reverse"
HREF="function.array-reverse.html"><LINK
REL="NEXT"
TITLE="array_shift"
HREF="function.array-shift.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"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.array-reverse.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.array-shift.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.array-search"
></A
>array_search</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN8015"
></A
><P
>    (PHP 4 &#62;= 4.0.5)</P
>array_search&nbsp;--&nbsp;
     Searches the array for a given value and returns the
     corresponding key if successful
    </DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN8018"
></A
><H2
>Description</H2
>mixed <B
CLASS="methodname"
>array_search</B
> ( mixed needle, array haystack [, bool strict])<BR
></BR
><P
>&#13;     Searches <TT
CLASS="parameter"
><I
>haystack</I
></TT
> for
     <TT
CLASS="parameter"
><I
>needle</I
></TT
> and returns the key if it is found in
     the array, <TT
CLASS="constant"
><B
>FALSE</B
></TT
> otherwise.
    </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
      Prior to PHP 4.2.0, <B
CLASS="function"
>array_search()</B
> returns
      <TT
CLASS="constant"
><B
>NULL</B
></TT
> on failure instead of <TT
CLASS="constant"
><B
>FALSE</B
></TT
>.
     </P
></BLOCKQUOTE
></DIV
><P
>&#13;     If the optional third parameter <TT
CLASS="parameter"
><I
>strict</I
></TT
> is set to
     <TT
CLASS="constant"
><B
>TRUE</B
></TT
> then the <B
CLASS="function"
>array_search()</B
>
     will also check the types of the <TT
CLASS="parameter"
><I
>needle</I
></TT
>
     in the <TT
CLASS="parameter"
><I
>haystack</I
></TT
>.
    </P
><DIV
CLASS="warning"
><P
></P
><TABLE
CLASS="warning"
BORDER="1"
WIDTH="100%"
><TR
><TD
ALIGN="CENTER"
><B
>Warning</B
></TD
></TR
><TR
><TD
ALIGN="LEFT"
><P
>This function may
return Boolean <TT
CLASS="constant"
><B
>FALSE</B
></TT
>, but may also return a non-Boolean value which
evaluates to <TT
CLASS="constant"
><B
>FALSE</B
></TT
>, such as <TT
CLASS="literal"
>0</TT
> or
"". Please read the section on <A
HREF="language.types.boolean.html"
>Booleans</A
> for more
information. Use <A
HREF="language.operators.comparison.html"
>the ===
operator</A
> for testing the return value of this
function.</P
></TD
></TR
></TABLE
></DIV
><P
>&#13;     See also <A
HREF="function.array-keys.html"
><B
CLASS="function"
>array_keys()</B
></A
> and <A
HREF="function.in-array.html"
><B
CLASS="function"
>in_array()</B
></A
>.
    </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.array-reverse.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.array-shift.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>array_reverse</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.array.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>array_shift</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>