- microtime: documentation ( source)
- array_merge: documentation ( source)
<?php
$st = microtime(true);
$x=array("x"=>1, "y"=>2); $y = array("y"=>3, "z"=>4);
for ($i=1; $i<=500000; $i++) { $y + $x; }
echo 'TIME:' . (microtime(true) - $st) . '<br/>';
$st = microtime(true);
$x=array("x"=>1, "y"=>2); $y = array("y"=>3, "z"=>4);
for ($i=1; $i<=500000; $i++) { array_merge($x, $y); }
echo 'TIME:' . (microtime(true) - $st) . '<br/>';