<?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.strspn.php',
    1 => 'strspn',
    2 => 'Trova la lunghezza di un testo che corrisponde alla maschera data',
  ),
  'up' => 
  array (
    0 => 'ref.strings.php',
    1 => 'String Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.strrpos.php',
    1 => 'strrpos',
  ),
  'next' => 
  array (
    0 => 'function.strstr.php',
    1 => 'strstr',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'it',
    'path' => 'reference/strings/functions/strspn.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.strspn" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">strspn</h1>
    <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">strspn</span> &mdash; <span class="dc-title">
     Trova la lunghezza di un testo che corrisponde alla maschera data
    </span></p>

   </div>
   <div class="refsect1 unknown-1435" id="refsect1-function.strspn-unknown-1435">
    <h3 class="title">Descrizione</h3>
     <div class="methodsynopsis dc-description">
      <span class="methodname"><strong>strspn</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$str1</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$str2</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$start</code><span class="initializer"> = ?</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$length</code><span class="initializer"> = ?</span></span><br>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

    <p class="simpara">
     Restituisce la lunghezza di un segmento di
     <code class="parameter">str1</code> che contiene completamente i caratteri
     presenti in <code class="parameter">str2</code>.
    </p>
    <p class="para">
     Il seguente codice:
     <div class="informalexample">
      <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$var </span><span style="color: #007700">= </span><span style="color: #0000BB">strspn</span><span style="color: #007700">(</span><span style="color: #DD0000">"42 is the answer, what is the question ..."</span><span style="color: #007700">, </span><span style="color: #DD0000">"1234567890"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
      </div>

     </div>
     assegnerà 2 a <var class="varname">$var</var>, poiché la stringa &quot;42&quot; è
     il più lungo segmento contenente i caratteri da &quot;1234567890&quot;.
    </p>
    <p class="simpara">
     Dal PHP 4.3.0, <span class="function"><strong>strspn()</strong></span> accetta altri due parametri 
     <span class="type">interi</span> opzionali: <code class="parameter">start</code> che può essere usato per 
     indicare la posizione di inizio da cui cercare, e
     <code class="parameter">length</code> per indicare la lunghezza della stringa da esaminare.
    </p>
    <p class="para">
     <div class="informalexample">
      <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">strspn</span><span style="color: #007700">(</span><span style="color: #DD0000">"foo"</span><span style="color: #007700">, </span><span style="color: #DD0000">"o"</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">); </span><span style="color: #FF8000">// 2<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
      </div>

     </div>
    </p>

    <blockquote class="note"><p><strong class="note">Nota</strong>: <span class="simpara">Questa funzione è
 binary-safe (gestisce correttamente i file binari)</span></p></blockquote>

    <p class="simpara">
     Vedere anche <span class="function"><a href="function.strcspn.php" class="function">strcspn()</a></span>.
    </p>
   </div>

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