mirror of
https://github.com/php/doc-it.git
synced 2026-04-28 17:53:23 +02:00
2769b12f1b
git-svn-id: https://svn.php.net/repository/phpdoc/it/trunk@314558 c90b9560-bf6c-de11-be94-00142212c4b1
216 lines
5.3 KiB
XML
216 lines
5.3 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!-- EN-Revision: n/a Maintainer: darvina Status: ready -->
|
|
<refentry xml:id="function.str-word-count" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>str_word_count</refname>
|
|
<refpurpose>
|
|
Restituisce informazioni sulle parole utilizzate in una stringa
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>mixed</type><methodname>str_word_count</methodname>
|
|
<methodparam><type>string</type><parameter>string</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>format</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>charlist</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Conta il numero di parole presenti in <parameter>string</parameter>.
|
|
Se non viene indicato il parametro opzionale <parameter>format</parameter>,
|
|
allora la funzione restituirà un intero indicante il numero di parole trovate.
|
|
Nel caso in cui sia specificato <parameter>format</parameter>, la funzione restituisce
|
|
una matrice il cui contenuto dipende dal parametro
|
|
<parameter>format</parameter>. I possibili valori per
|
|
<parameter>format</parameter> ed i rispettivi output sono elencati di seguito.
|
|
</para>
|
|
<para>
|
|
Per gli scopi di questa funzione 'parola' è definita come testo dipendente dalle
|
|
impostazioni locali, contenente caratteri alfabetici, che può contenere, ma non cominciare,
|
|
con i caratteri "'" and "-".
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>string</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La stringa
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>format</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Indica il tipo di valore restituito dalla funzione. Le attuali impostazioni ammesse
|
|
per il parametro sono:
|
|
<itemizedlist>
|
|
<listitem>
|
|
<simpara>
|
|
0 - restituisce il numero di parole trovate
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
1 - restituisce una matrice contenente tutte le parole trovate all'interno di
|
|
<parameter>string</parameter>.
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
2 - restituisce una matrice associativa, in cui le chiavi sono la posizione
|
|
numerica della parola in <parameter>string</parameter> ed
|
|
il valore è la parola stessa.
|
|
</simpara>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>charlist</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Lista di caratteri addizionali da considerare come 'parole'
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Restituisce un intero od una matrice in base al valore di
|
|
<parameter>format</parameter>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>5.1.0</entry>
|
|
<entry>
|
|
Aggiunto il parametro <parameter>charlist</parameter>
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Esempio di uso di <function>str_word_count</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$str = "Hello fri3nd, you're
|
|
looking good today!";
|
|
|
|
print_r(str_word_count($str, 1));
|
|
print_r(str_word_count($str, 2));
|
|
print_r(str_word_count($str, 1, 'àáãç3'));
|
|
|
|
echo str_word_count($str);
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[0] => Hello
|
|
[1] => fri
|
|
[2] => nd
|
|
[3] => you're
|
|
[4] => looking
|
|
[5] => good
|
|
[6] => today
|
|
)
|
|
|
|
Array
|
|
(
|
|
[0] => Hello
|
|
[6] => fri
|
|
[10] => nd
|
|
[14] => you're
|
|
[29] => looking
|
|
[46] => good
|
|
[51] => today
|
|
)
|
|
|
|
Array
|
|
(
|
|
[0] => Hello
|
|
[1] => fri3nd
|
|
[2] => you're
|
|
[3] => looking
|
|
[4] => good
|
|
[5] => today
|
|
)
|
|
|
|
7
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>explode</function></member>
|
|
<member><function>preg_split</function></member>
|
|
<member><function>split</function></member>
|
|
<member><function>count_chars</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
|
|
-->
|