Sophie

Sophie

distrib > PLD > ac > amd64 > media > dist > by-pkgid > dd8ef74e7a184506d40e4328053fb785 > files > 276

php-manual-ro-20051028-1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML
><HEAD
><TITLE
>count</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Manual PHP"
HREF="index.html"><LINK
REL="UP"
TITLE="Array - funcþii"
HREF="ref.array.html"><LINK
REL="PREVIOUS"
TITLE="compact"
HREF="function.compact.html"><LINK
REL="NEXT"
TITLE="current"
HREF="function.current.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-2"></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 PHP</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.compact.html"
ACCESSKEY="P"
>Înapoi</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.current.html"
ACCESSKEY="N"
>Înainte</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.count"
></A
>count</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN7180"
></A
><P
>    (PHP 3, PHP 4 , PHP 5)</P
>count&nbsp;--&nbsp;Count elements in a variable</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN7183"
></A
><H2
>Description</H2
>int <B
CLASS="methodname"
>count</B
> ( mixed var)<BR
></BR
><P
>&#13;     Returns the number of elements in <VAR
CLASS="parameter"
>var</VAR
>,
     which is typically an <A
HREF="language.types.array.html"
><B
CLASS="type"
>array</B
></A
> (since anything else will have
     one element).
    </P
><P
>&#13;     If <VAR
CLASS="parameter"
>var</VAR
> is not an array, <VAR
CLASS="literal"
>1</VAR
> will
     be returned (exception: <VAR
CLASS="literal"
>count(<TT
CLASS="constant"
><B
>NULL</B
></TT
>)</VAR
> equals
     <VAR
CLASS="literal"
>0</VAR
>).
    </P
><DIV
CLASS="warning"
><P
></P
><TABLE
CLASS="warning"
BORDER="1"
WIDTH="100%"
><TR
><TD
ALIGN="CENTER"
><B
>Avertisment</B
></TD
></TR
><TR
><TD
ALIGN="LEFT"
><P
>&#13;      <B
CLASS="function"
>count()</B
> may return 0 for a variable that
      isn't set, but it may also return 0 for a variable that has
      been initialized with an empty array. Use
      <A
HREF="function.isset.html"
><B
CLASS="function"
>isset()</B
></A
> to test if a variable is set.
     </P
></TD
></TR
></TABLE
></DIV
><P
>&#13;     Please see the <A
HREF="language.types.array.html"
>Arrays</A
>
     section of the manual for a detailed explanation of how arrays
     are implemented and used in PHP.
    </P
><P
>&#13;     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN7207"
></A
><P
><B
>Exemplu 1. <B
CLASS="function"
>count()</B
> example</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><code><font color="#000000">
$a[0] = 1;<br />$a[1] = 3;<br />$a[2] = 5;<br />$result = count ($a);<br />// $result == 3<br /><br />$b[0] = 7;<br />$b[5] = 9;<br />$b[10] = 11;<br />$result = count ($b);<br />// $result == 3;</font>
</code></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
    </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Not&#227;: </B
>
     The <A
HREF="function.sizeof.html"
><B
CLASS="function"
>sizeof()</B
></A
> function is an
     <A
HREF="aliases.html"
>alias</A
> for <B
CLASS="function"
>count()</B
>.
    </P
></BLOCKQUOTE
></DIV
><P
>&#13;     See also <A
HREF="function.is-array.html"
><B
CLASS="function"
>is_array()</B
></A
>,
     <A
HREF="function.isset.html"
><B
CLASS="function"
>isset()</B
></A
>, and
     <A
HREF="function.strlen.html"
><B
CLASS="function"
>strlen()</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.compact.html"
ACCESSKEY="P"
>Înapoi</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Acas&#227;</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.current.html"
ACCESSKEY="N"
>Înainte</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>compact</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.array.html"
ACCESSKEY="U"
>Sus</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>current</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>