<?php
arr public ArrayObject::exchangeArray ( mix $input )
where,
$input = The new array or object to exchange with the current array
?>
<?php
$BR_dwarfs = [ "Dengoso" => 1, "Mestre" => 2,
"Zangado" => 3, "Feliz" => 4,
"Atchim" => 5, "Soneca" => 6, "Dunga" => 7 ];
$EN_dwarfs = [ 'Bashful' => 1 , 'Doc' => 2,
'Grumpy' => 3, 'Happy' => 4,
'Sneezy' => 5, 'Sleepy' => 6, 'Dopey' => 7];
$dwArrayObject = new ArrayObject($BR_dwarfs);
$BRold = $dwArrayObject->exchangeArray($EN_dwarfs);
echo '<br>';
foreach($BRold as $kbr => $vbr)
{
echo '[ ' . $vbr . ' ] => ' . $kbr . '<br>';
}
echo '<br><br>';
foreach($dwArrayObject as $ken => $ven)
{
echo '[ ' . $ven . ' ] => ' . $ken . '<br>';
}
?>
<?php
class test01
{
public $var01 = 'Alea jacta est';
public $var02 = 'Luck is on';
}
$obj01 = new test01;
$bArray = [ 'Bashful' => 1 , 'Doc' => 2,
'Grumpy' => 3, 'Happy' => 4,
'Sneezy' => 5, 'Sleepy' => 6, 'Dopey' => 7];
$obj01Object = new ArrayObject($obj01);
$aold = $obj01Object->exchangeArray($bArray);
echo '<br>';
// var_dump($aold);
foreach($aold as $ka => $va)
echo '[ ' . $va . ' ] => ' . $ka . '<br>';
echo '<br><br>';
// var_dump($obj01Object);
foreach($obj01Object as $kb => $vb)
echo '[ ' . $vb . ' ] => ' . $kb . '<br>';
?>