mirror of
https://github.com/php/doc-it.git
synced 2026-04-27 17:23:38 +02:00
2d3dbd42a0
git-svn-id: https://svn.php.net/repository/phpdoc/it/trunk@351144 c90b9560-bf6c-de11-be94-00142212c4b1
153 lines
3.9 KiB
XML
153 lines
3.9 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!-- EN-Revision: 96c9d88bad9a7d7d44bfb7f26c226df7ee9ddf26 Maintainer: pastore Status: ready -->
|
|
<!-- CREDITS: darvina -->
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.count-chars">
|
|
<refnamediv>
|
|
<refname>count_chars</refname>
|
|
<refpurpose>Restituisce informazioni sui caratteri usati in una stringa</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>mixed</type><methodname>count_chars</methodname>
|
|
<methodparam><type>string</type><parameter>string</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>mode</parameter><initializer>0</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
La funzione conta il numero di occorrenze di ogni valore dei byte (0..255) nella
|
|
stringa <parameter>string</parameter> e li restituisce in vari modi.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>string</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La stringa esaminata.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>mode</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Vedere i valori restituiti.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
A seconda di <parameter>mode</parameter>
|
|
<function>count_chars</function> restituisce uno dei seguenti:
|
|
<itemizedlist>
|
|
<listitem>
|
|
<simpara>
|
|
0 - un array con il valore del byte come chiave e la frequenza di
|
|
ogni byte come valore.
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
1 - stesso di 0 ma vengono elencati solo i valori dei byte con
|
|
una frequenza maggiore di zero.
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
2 - stesso di 0 ma vengono elencati solo i valori dei byte con
|
|
una frequenza uguale a zero.
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
3 - viene restituita una stringa contenente tutti i caratteri unici.
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
4 - viene restituita una stringa contenente tutti i caratteri non utilizzati.
|
|
</simpara>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Esempio di <function>count_chars</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$data = "Two Ts and one F.";
|
|
|
|
foreach (count_chars($data, 1) as $i => $val) {
|
|
echo "Vi sono $val istanze di \"" , chr($i) , "\" nella stringa.\n";
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
Vi sono 4 istanze di " " nella stringa.
|
|
Vi sono 1 istanze di "." nella stringa.
|
|
Vi sono 1 istanze di "F" nella stringa.
|
|
Vi sono 2 istanze di "T" nella stringa.
|
|
Vi sono 1 istanze di "a" nella stringa.
|
|
Vi sono 1 istanze di "d" nella stringa.
|
|
Vi sono 1 istanze di "e" nella stringa.
|
|
Vi sono 2 istanze di "n" nella stringa.
|
|
Vi sono 2 istanze di "o" nella stringa.
|
|
Vi sono 1 istanze di "s" nella stringa.
|
|
Vi sono 1 istanze di "w" nella stringa.
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>strpos</function></member>
|
|
<member><function>substr_count</function></member>
|
|
</simplelist>
|
|
</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:"~/.phpdoc/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
|
|
-->
|