webHauser Blog

Icon

Welcome to webHauser weblog

Array union example


$a = array(1,2,3);
$b = array(1,7,8,9,10);
$c = $a + $b; // Union of $a and $b
echo "Union of \$a and \$b: \n";
print_r($c);

Output:
Union of arrays $a and $b:
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 9 [4] => 10 )

Leave a Reply

You must be logged in to post a comment.