Is there an array function in PHP that somehow does array_merge, comparing the values, ignoring the keys? I think that array_unique(array_merge($a, $b))
works, however I believe there must be a nicer way to do this.
eg.
$a = array(0 => 0, 1 => 1, 2 => 2);
$b = array(0 => 2, 1 => 3, 2 => 4);
resulting in:
$ab = array(0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4);
Please note that I don't care about the keys in $ab
, however it would be nice if they were ascending, starting at 0 to count($ab)-1
.