I want to have an array that contains a list of something, then I have another array that contains a list of something. I want to add those arrays up to each other.
For example, I have this
<?php
$greetings1 = array (
'a' => 'hello',
'b' => 'hi'
);
$greetings2 = array ('c' => 'hey',
'd' => 'greetings'
);
array_push($greetings1, $greetings2);
foreach($greetings1 as $a => $b) {
echo $a.' and '.$b."<br/>";
}
?>
Çıktı ki ben bunu istiyorum:
a and hello
b and hi
c and hey
d and greetings
Yukarıdaki php kod gerçek çıktı:
a and hello
b and hi
0 and Array
So how do I properly add the two arrays up?
Thanks!