<?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.strrpos.php',
    1 => 'strrpos',
    2 => 'Trova la posizione dell\'ultima occorrenza di un carattere in una stringa',
  ),
  'up' => 
  array (
    0 => 'ref.strings.php',
    1 => 'String Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.strripos.php',
    1 => 'strripos',
  ),
  'next' => 
  array (
    0 => 'function.strspn.php',
    1 => 'strspn',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'it',
    'path' => 'reference/strings/functions/strrpos.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.strrpos" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">strrpos</h1>
    <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">strrpos</span> &mdash; <span class="dc-title">
     Trova la posizione dell&#039;ultima occorrenza di un carattere in una stringa
    </span></p>

   </div>
   <div class="refsect1 unknown-1432" id="refsect1-function.strrpos-unknown-1432">
    <h3 class="title">Descrizione</h3>
     <div class="methodsynopsis dc-description">
      <span class="methodname"><strong>strrpos</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 dell&#039;ultima occorrenza di
     <code class="parameter">needle</code> nella stringa
     <code class="parameter">haystack</code>. Fare attenzione che <code class="parameter">needle</code>,
     in PHP 4, può essere solo un singolo carattere. Se si passa una stringa,
     verrà utilizzato solo il primo 
     carattere.
    </p>
    <p class="para">
     Se <code class="parameter">needle</code> non viene trovato, la funzione restituisce <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
    </p>
    <p class="para">
     Si può facilmente confondere i valori restituiti &quot;per carattere alla
     posizione 0&quot; e per &quot;carattere non trovato&quot;. Ecco come rilevare
     la differenza:
     <div class="informalexample">
      <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">// in PHP 4.0b3 e successivi:<br /></span><span style="color: #0000BB">$pos </span><span style="color: #007700">= </span><span style="color: #0000BB">strrpos</span><span style="color: #007700">(</span><span style="color: #0000BB">$mystring</span><span style="color: #007700">, </span><span style="color: #DD0000">"b"</span><span style="color: #007700">);<br />if (</span><span style="color: #0000BB">$pos </span><span style="color: #007700">=== </span><span style="color: #0000BB">false</span><span style="color: #007700">) { </span><span style="color: #FF8000">// note: three equal signs<br />    // not found...<br /></span><span style="color: #007700">}<br /><br /></span><span style="color: #FF8000">// nelle versioni precedenti alla 4.0b3:<br /></span><span style="color: #0000BB">$pos </span><span style="color: #007700">= </span><span style="color: #0000BB">strrpos</span><span style="color: #007700">(</span><span style="color: #0000BB">$mystring</span><span style="color: #007700">, </span><span style="color: #DD0000">"b"</span><span style="color: #007700">);<br />if (</span><span style="color: #0000BB">is_bool</span><span style="color: #007700">(</span><span style="color: #0000BB">$pos</span><span style="color: #007700">) &amp;&amp; !</span><span style="color: #0000BB">$pos</span><span style="color: #007700">) {<br />    </span><span style="color: #FF8000">// not found...<br /></span><span style="color: #007700">}<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, viene convertito in
     un intero, e usato come valore ordinale di un carattere.
    </p>
    <blockquote class="note"><p><strong class="note">Nota</strong>: 
     <span class="simpara">
      Dal PHP 5.0.0 <code class="parameter">offset</code> può
      essere indicato per indicare di iniziare la ricerca nella stringa da una
      posizione di caratteri arbitraria. Valori negativi fermeranno la ricerca ad un punto arbitrario
      prima della fine della stringa.
     </span>
    </p></blockquote>
    <blockquote class="note"><p><strong class="note">Nota</strong>: 
     <span class="simpara">
      Il parametro <code class="parameter">needle</code> può essere una stringa di uno o più
      caratteri a partire dal PHP 5.0.0.
     </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.strripos.php" class="function">strripos()</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> e
     <span class="function"><a href="function.strstr.php" class="function">strstr()</a></span>.
    </p>
   </div>

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