I'm testing some code of PHP(5.4.4) in apache(2.2.22).
I wonder how PHP actually work in parsing the code below.
<?php
$x = array(
'st1' => 'gd1',
'st2' => 'gd2'
);
$y = array(
'st1' => 'te1',
'st3' => 'te3'
);
$z = $x + $y;
var_dump($z);
The result is
array(3) { ["st1"]=> string(3) "gd1" ["st2"]=> string(3) "gd2" ["st3"]=> string(3) "te3" }
But how it works?
eg(I guessed): $x first parsed and added into $z, while parsing $y, the php interpreter think the key 'st1' existed(means $x's priority is higher than $y), and tried not to override it and add 'st3' and it's value.
Just want to make sure whether I misunderstood it...
unionof$xand$y