<?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.strtr.php',
    1 => 'strtr',
    2 => 'Traduce certi caratteri',
  ),
  'up' => 
  array (
    0 => 'ref.strings.php',
    1 => 'String Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.strtoupper.php',
    1 => 'strtoupper',
  ),
  'next' => 
  array (
    0 => 'function.substr.php',
    1 => 'substr',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'it',
    'path' => 'reference/strings/functions/strtr.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.strtr" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">strtr</h1>
    <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">strtr</span> &mdash; <span class="dc-title">Traduce certi caratteri</span></p>

   </div>
   <div class="refsect1 unknown-1450" id="refsect1-function.strtr-unknown-1450">
    <h3 class="title">Descrizione</h3>
     <div class="methodsynopsis dc-description">
      <span class="methodname"><strong>strtr</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$str</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$from</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$to</code></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

     <div class="methodsynopsis dc-description"><span class="methodname"><strong>strtr</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$str</code></span>, <span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">$replace_pairs</code></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

    <p class="para rdfs-comment">
     Questa funzione restituisce una copia di <code class="parameter">str</code>,
     traducendo tutti i caratteri di 
     <code class="parameter">from</code> al corrispondente carattere indicato in
     <code class="parameter">to</code>.
    </p>
    <p class="para">
     Se <code class="parameter">from</code> e <code class="parameter">to</code> hanno
     lunghezze differenti, i caratteri in più presenti nella stringa più lunga
     saranno ignorati.
     <div class="example" id="example-1">
      <p><strong>Example #1 Esempio di uso di <span class="function"><strong>strtr()</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 />$addr </span><span style="color: #007700">= </span><span style="color: #0000BB">strtr</span><span style="color: #007700">(</span><span style="color: #0000BB">$addr</span><span style="color: #007700">, </span><span style="color: #DD0000">"äåö"</span><span style="color: #007700">, </span><span style="color: #DD0000">"aao"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
      </div>

     </div>
    </p>
    <p class="para">
     <span class="function"><strong>strtr()</strong></span> può essere eseguita con solo due argomenti.
     Se viene chiamata con due parametri si comporta in modo nuovo:
     <code class="parameter">from</code> deve essere un matrice che contiene le coppie
     stringa -&gt; stringa da sostituire nella stringa sorgente.
     <span class="function"><strong>strtr()</strong></span> cercherà sempre prima di incrociare
     il testo più lungo e *NON* tenterà di sostituire
     parti su cui ha già lavorato.
    </p>
    <div class="example" id="example-2">
     <p><strong>Example #2 Esempio di uso di <span class="function"><strong>strtr()</strong></span> con due parametri</strong></p>
      <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$trans </span><span style="color: #007700">= array(</span><span style="color: #DD0000">"hello" </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">"hi"</span><span style="color: #007700">, </span><span style="color: #DD0000">"hi" </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">"hello"</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">strtr</span><span style="color: #007700">(</span><span style="color: #DD0000">"hi all, I said hello"</span><span style="color: #007700">, </span><span style="color: #0000BB">$trans</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
      </div>

    <div class="example-contents"><p>
     Questo visualizzerà: 
    </p></div>
      <div class="example-contents screen">
<div class="annotation-interactive cdata"><pre>
hello all, I said hi
</pre></div>
      </div>
    </div>
    <blockquote class="note"><p><strong class="note">Nota</strong>: 
     <span class="simpara">
      I parametri opzionali <code class="parameter">to</code> e 
      <code class="parameter">from</code> sono stati aggiunti in PHP 4.0.0
     </span>
    </p></blockquote>
    <p class="para">
     Vedere anche <span class="function"><strong>ereg_replace()</strong></span>.
    </p>
   </div>

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