<?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.stripos.php',
    1 => 'stripos',
    2 => 'Trova la prima occorrenza in una stringa senza distinzione tra maiuscole e minuscole',
  ),
  'up' => 
  array (
    0 => 'ref.strings.php',
    1 => 'String Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.stripcslashes.php',
    1 => 'stripcslashes',
  ),
  'next' => 
  array (
    0 => 'function.stripslashes.php',
    1 => 'stripslashes',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'it',
    'path' => 'reference/strings/functions/stripos.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.stripos" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">stripos</h1>
    <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">stripos</span> &mdash; <span class="dc-title">
     Trova la prima occorrenza in una stringa senza distinzione tra maiuscole e minuscole    
    </span></p>

   </div>
   <div class="refsect1 unknown-1396" id="refsect1-function.stripos-unknown-1396">
    <h3 class="title">Descrizione</h3>
     <div class="methodsynopsis dc-description">
      <span class="methodname"><strong>stripos</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$haystack</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$needle</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$offset</code><span class="initializer"> = ?</span></span>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

    <p class="para rdfs-comment">
     Restituisce la posizione numerica della prima occorrenza di
     <code class="parameter">needle</code> nella <span class="type">stringa</span> <code class="parameter">haystack</code>.
     Differentemente da <span class="function"><strong> strpos()</strong></span>, 
     <span class="function"><strong>stripos()</strong></span> non distingue tra maiuscole e minuscole.
    </p>
    <p class="para">
     Occorre rilevare che <code class="parameter">needle</code> può essere una stringa di uno o 
     più caratteri.
    </p>
    <p class="para">
     Se <code class="parameter">needle</code> non viene trovato,
     <span class="function"><strong>stripos()</strong></span> restituirà <span class="type"><a href="language.types.boolean.php" class="type boolean">boolean</a></span> <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
    </p>

    <div class="warning"><strong class="warning">Avviso</strong><p class="simpara">Questa funzione può
restituire il Booleano <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>, ma può anche restituire un valore non-Booleano valutato
come <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>. Fare riferimento alla sezione <a href="language.types.boolean.php" class="link">Booleans</a> per maggiori 
informazioni. Usare <a href="language.operators.comparison.php" class="link">l&#039;operatore ===
</a> per controllare il valore restituito da questa 
funzione.</p></div>

    <p class="para">
     <div class="example" id="example-1">
     <p><strong>Example #1 Esempi di uso di <span class="function"><strong>stripos()</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 />$findme    </span><span style="color: #007700">= </span><span style="color: #DD0000">'a'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$mystring1 </span><span style="color: #007700">= </span><span style="color: #DD0000">'xyz'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$mystring2 </span><span style="color: #007700">= </span><span style="color: #DD0000">'ABC'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$pos1 </span><span style="color: #007700">= </span><span style="color: #0000BB">stripos</span><span style="color: #007700">(</span><span style="color: #0000BB">$mystring1</span><span style="color: #007700">, </span><span style="color: #0000BB">$findme</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$pos2 </span><span style="color: #007700">= </span><span style="color: #0000BB">stripos</span><span style="color: #007700">(</span><span style="color: #0000BB">$mystring2</span><span style="color: #007700">, </span><span style="color: #0000BB">$findme</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// No, 'a' non è certamente in 'xyz'<br /></span><span style="color: #007700">if (</span><span style="color: #0000BB">$pos1 </span><span style="color: #007700">=== </span><span style="color: #0000BB">false</span><span style="color: #007700">) {<br />    echo </span><span style="color: #DD0000">"The string '</span><span style="color: #0000BB">$findme</span><span style="color: #DD0000">' was not found in the string '</span><span style="color: #0000BB">$mystring1</span><span style="color: #DD0000">'"</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #FF8000">// Notate l'uso di ===.  Semplicemente == non avrebbe funzionato come atteso<br />// perché la posizione di  'a' è nel carattere 0 (il primo).<br /></span><span style="color: #007700">if (</span><span style="color: #0000BB">$pos2 </span><span style="color: #007700">!== </span><span style="color: #0000BB">false</span><span style="color: #007700">) {<br />    echo </span><span style="color: #DD0000">"We found '</span><span style="color: #0000BB">$findme</span><span style="color: #DD0000">' in '</span><span style="color: #0000BB">$mystring2</span><span style="color: #DD0000">' at position </span><span style="color: #0000BB">$pos2</span><span style="color: #DD0000">"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
      </div>

     </div>
    </p>
    <p class="para">
     Se <code class="parameter">needle</code> non è una stringa, sarà convertito
     in un intero e utilizzato come valore ordinale di un carattere.
    </p>
    <p class="para">
     Il parametro opzionale <code class="parameter">offset</code> permette di
     indicare da quale carattere di <code class="parameter">haystack</code> iniziare
     la ricerca. La posizione restituita sarà relativa all&#039;inizio di
     <code class="parameter">haystack</code>.
    </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="para">
     Vedere anche <span class="function"><a href="function.strpos.php" class="function">strpos()</a></span>, <span class="function"><a href="function.strrpos.php" class="function">strrpos()</a></span>,
     <span class="function"><a href="function.strrchr.php" class="function">strrchr()</a></span>, <span class="function"><a href="function.substr.php" class="function">substr()</a></span>,
     <span class="function"><a href="function.stristr.php" class="function">stristr()</a></span>, <span class="function"><a href="function.strstr.php" class="function">strstr()</a></span>,
     <span class="function"><a href="function.strripos.php" class="function">strripos()</a></span> e <span class="function"><a href="function.str-ireplace.php" class="function">str_ireplace()</a></span>.
    </p>
   </div>

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