<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.arrayobject.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'arrayobject.exchangearray.php',
    1 => 'ArrayObject::exchangeArray',
    2 => 'Exchange the array for another one',
  ),
  'up' => 
  array (
    0 => 'class.arrayobject.php',
    1 => 'ArrayObject',
  ),
  'prev' => 
  array (
    0 => 'arrayobject.count.php',
    1 => 'ArrayObject::count',
  ),
  'next' => 
  array (
    0 => 'arrayobject.getarraycopy.php',
    1 => 'ArrayObject::getArrayCopy',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/spl/arrayobject/exchangearray.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="arrayobject.exchangearray" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ArrayObject::exchangeArray</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.1.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">ArrayObject::exchangeArray</span> &mdash; <span class="dc-title">Exchange the array for another one</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-arrayobject.exchangearray-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>ArrayObject::exchangeArray</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.object.php" class="type object">object</a></span></span> <code class="parameter">$array</code></span>): <span class="type"><a href="language.types.array.php" class="type array">array</a></span></div>

  <p class="para rdfs-comment">
   Exchange the current <span class="type"><a href="language.types.array.php" class="type array">array</a></span> with another <span class="type"><a href="language.types.array.php" class="type array">array</a></span> or <span class="type"><a href="language.types.object.php" class="type object">object</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-arrayobject.exchangearray-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">array</code></dt>
     <dd>
      <p class="para">
       The new <span class="type"><a href="language.types.array.php" class="type array">array</a></span> or <span class="type"><a href="language.types.object.php" class="type object">object</a></span> to exchange with the current array.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-arrayobject.exchangearray-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Returns the old <span class="type"><a href="language.types.array.php" class="type array">array</a></span>.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-arrayobject.exchangearray-examples">
  <h3 class="title">Beispiele</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Beispiel #1 <span class="function"><strong>ArrayObject::exchangeArray()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// Array of available fruits<br /></span><span style="color: #0000BB">$fruits </span><span style="color: #007700">= array(</span><span style="color: #DD0000">"lemons" </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #DD0000">"oranges" </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">4</span><span style="color: #007700">, </span><span style="color: #DD0000">"bananas" </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">5</span><span style="color: #007700">, </span><span style="color: #DD0000">"apples" </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">10</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">// Array of locations in Europe<br /></span><span style="color: #0000BB">$locations </span><span style="color: #007700">= array(</span><span style="color: #DD0000">'Amsterdam'</span><span style="color: #007700">, </span><span style="color: #DD0000">'Paris'</span><span style="color: #007700">, </span><span style="color: #DD0000">'London'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$fruitsArrayObject </span><span style="color: #007700">= new </span><span style="color: #0000BB">ArrayObject</span><span style="color: #007700">(</span><span style="color: #0000BB">$fruits</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Now exchange fruits for locations<br /></span><span style="color: #0000BB">$old </span><span style="color: #007700">= </span><span style="color: #0000BB">$fruitsArrayObject</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">exchangeArray</span><span style="color: #007700">(</span><span style="color: #0000BB">$locations</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$old</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$fruitsArrayObject</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Das oben gezeigte Beispiel erzeugt folgende Ausgabe:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">array(4) {
  [&quot;lemons&quot;]=&gt;
  int(1)
  [&quot;oranges&quot;]=&gt;
  int(4)
  [&quot;bananas&quot;]=&gt;
  int(5)
  [&quot;apples&quot;]=&gt;
  int(10)
}
object(ArrayObject)#1 (1) {
  [&quot;storage&quot;:&quot;ArrayObject&quot;:private]=&gt;
  array(3) {
    [0]=&gt;
    string(9) &quot;Amsterdam&quot;
    [1]=&gt;
    string(5) &quot;Paris&quot;
    [2]=&gt;
    string(6) &quot;London&quot;
  }
}</pre>
</div>
    </div>
   </div>
  </p>
 </div>

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