mirror of
https://github.com/php/doc-it.git
synced 2026-03-26 16:42:06 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/it/trunk@82040 c90b9560-bf6c-de11-be94-00142212c4b1
95 lines
2.8 KiB
XML
95 lines
2.8 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- splitted from ./it/functions/array.xml, last change in rev 1.1 -->
|
|
<!-- last change to 'count' in en/ tree in rev 1.2 -->
|
|
<!-- EN-Revision: 1.4 Maintainer: cucinato Status: ready -->
|
|
<!-- OLD-Revision: 1.173/EN.1.2 -->
|
|
<refentry id="function.count">
|
|
<refnamediv>
|
|
<refname>count</refname>
|
|
<refpurpose>Conta gli elementi in una variabile</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Descrizione</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>count</methodname>
|
|
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Restituisce il numero di elementi in <parameter>var</parameter>,
|
|
la quale è di norma un array (dal momento che qualsiasi altro oggetto avrà un
|
|
elemento).
|
|
</para>
|
|
<para>
|
|
Se <parameter>var</parameter> non è un array, verrà restituito <literal>1</literal>
|
|
(eccezione: <literal>count(&null;)</literal> restituisce
|
|
<literal>0</literal>).
|
|
</para>
|
|
<warning>
|
|
<para>
|
|
<function>count</function> può restituire 0 per una variabile che
|
|
non è impostata, ma può anche restituire 0 per una variabile che è
|
|
stata inizializzata con un array vuoto. Usare
|
|
<function>isset</function> per verificare se una variabile è impostata.
|
|
</para>
|
|
</warning>
|
|
<para>
|
|
Vedere la sezione <link linkend="language.types.array">Arrays</link>
|
|
nel manuale per una spiegazione dettagliata di come gli array siano
|
|
implementati ed usati in PHP.
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>esempio di <function>count</function></title>
|
|
<programlisting role="php">
|
|
<!-- TODO: examples about count(null), count(false), count(object).. -->
|
|
<![CDATA[
|
|
$a[0] = 1;
|
|
$a[1] = 3;
|
|
$a[2] = 5;
|
|
$risultato = count ($a);
|
|
//$risultato == 3
|
|
|
|
$b[0] = 7;
|
|
$b[5] = 9;
|
|
$b[10] = 11;
|
|
$risultato = count ($b);
|
|
// $risultato == 3;
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<note>
|
|
<para>
|
|
La funzione <function>sizeof</function> è un
|
|
<link linkend="aliases">alias</link> per <function>count</function>.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
Vedere anche <function>is_array</function>,
|
|
<function>isset</function> e
|
|
<function>strlen</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|