<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.strings.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.str-word-count.php',
    1 => 'str_word_count',
    2 => 'Restituisce informazioni sulle parole utilizzate in una stringa',
  ),
  'up' => 
  array (
    0 => 'ref.strings.php',
    1 => 'String Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.str-starts-with.php',
    1 => 'str_starts_with',
  ),
  'next' => 
  array (
    0 => 'function.strcasecmp.php',
    1 => 'strcasecmp',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'it',
    'path' => 'reference/strings/functions/str-word-count.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.str-word-count" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">str_word_count</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">str_word_count</span> &mdash; <span class="dc-title">
   Restituisce informazioni sulle parole utilizzate in una stringa
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.str-word-count-description">
  <h3 class="title">Descrizione</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>str_word_count</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$string</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$format</code><span class="initializer"> = ?</span></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$charlist</code><span class="initializer"> = ?</span></span>): <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span></div>

  <p class="para rdfs-comment">
   Conta il numero di parole presenti in <code class="parameter">string</code>. 
   Se non viene indicato il parametro opzionale <code class="parameter">format</code>,
   allora la funzione restituirà un intero indicante il numero di parole trovate.
   Nel caso in cui sia specificato <code class="parameter">format</code>, la funzione restituisce
   una matrice il cui contenuto dipende dal parametro
   <code class="parameter">format</code>. I possibili valori per 
   <code class="parameter">format</code> ed i rispettivi output sono elencati di seguito.
  </p>
  <p class="para">
   Per gli scopi di questa funzione &#039;parola&#039; è definita come testo dipendente dalle
   impostazioni locali, contenente caratteri alfabetici, che può contenere, ma non cominciare,
   con i caratteri &quot;&#039;&quot; and &quot;-&quot;.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.str-word-count-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">string</code></dt>
     <dd>
      <p class="para">
       La stringa
      </p>
     </dd>
    
    
     <dt><code class="parameter">format</code></dt>
     <dd>
      <p class="para">
       Indica il tipo di valore restituito dalla funzione. Le attuali impostazioni ammesse
       per il parametro sono:
       <ul class="itemizedlist">
        <li class="listitem">
         <span class="simpara">
          0 - restituisce il numero di parole trovate
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          1 - restituisce una matrice contenente tutte le parole trovate all&#039;interno di
        <code class="parameter">string</code>.
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          2 - restituisce una matrice associativa, in cui le chiavi sono la posizione
          numerica della parola in <code class="parameter">string</code> ed
          il valore è la parola stessa.
         </span>
        </li> 
       </ul>
      </p>
     </dd>
    
    
     <dt><code class="parameter">charlist</code></dt>
     <dd>
      <p class="para">
       Lista di caratteri addizionali da considerare come &#039;parole&#039;
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.str-word-count-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="para">
   Restituisce un intero od una matrice in base al valore di
   <code class="parameter">format</code>.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.str-word-count-changelog">
  <h3 class="title">Log delle modifiche</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Versione</th>
       <th>Descrizione</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>5.1.0</td>
       <td>
        Aggiunto il parametro <code class="parameter">charlist</code>
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.str-word-count-examples">
  <h3 class="title">Esempi</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 Esempio di uso di <span class="function"><strong>str_word_count()</strong></span></strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$str </span><span style="color: #007700">= </span><span style="color: #DD0000">"Hello fri3nd, you're<br />       looking          good today!"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">str_word_count</span><span style="color: #007700">(</span><span style="color: #0000BB">$str</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">str_word_count</span><span style="color: #007700">(</span><span style="color: #0000BB">$str</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">str_word_count</span><span style="color: #007700">(</span><span style="color: #0000BB">$str</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #DD0000">'àáãç3'</span><span style="color: #007700">));<br /><br />echo </span><span style="color: #0000BB">str_word_count</span><span style="color: #007700">(</span><span style="color: #0000BB">$str</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Il precedente esempio visualizzerà:</p></div>
    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">Array
(
    [0] =&gt; Hello
    [1] =&gt; fri
    [2] =&gt; nd
    [3] =&gt; you&#039;re
    [4] =&gt; looking
    [5] =&gt; good
    [6] =&gt; today
)

Array
(
    [0] =&gt; Hello
    [6] =&gt; fri
    [10] =&gt; nd
    [14] =&gt; you&#039;re
    [29] =&gt; looking
    [46] =&gt; good
    [51] =&gt; today
)

Array
(
    [0] =&gt; Hello
    [1] =&gt; fri3nd
    [2] =&gt; you&#039;re
    [3] =&gt; looking
    [4] =&gt; good
    [5] =&gt; today
)

7</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.str-word-count-seealso">
  <h3 class="title">Vedere anche:</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.explode.php" class="function" rel="rdfs-seeAlso">explode()</a> - Suddivide una stringa</span></li>
    <li><span class="function"><a href="function.preg-split.php" class="function" rel="rdfs-seeAlso">preg_split()</a> - Suddivisione di una stringa tramite le espressioni regolari</span></li>
    <li><span class="function"><strong>split()</strong></span></li>
    <li><span class="function"><a href="function.count-chars.php" class="function" rel="rdfs-seeAlso">count_chars()</a> - Restituisce informazioni sui caratteri usati in una stringa</span></li>
    <li><span class="function"><a href="function.substr-count.php" class="function" rel="rdfs-seeAlso">substr_count()</a> - Conta il numero di occorrenze di un segmento di stringa</span></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>