I am new to php ,facing some issues between array_push and array_merge
I used two array in input $a(Blank array) and $b(Associative array with some value)
In case of array_merge
when i used array_merge i got same result in both cases ($c and $f) but in put i used an associative array with key "212" and value "aa" but in output i get an array with key "0" and value "aa"
now in case of
array_push i get 2 different outputs (int 1 and int 2)for two different cases for 2 same inputs
I tried this
$a=array();
$b= array(212=>"aa");
$c=array_merge($a,$b);
$f=array_merge($b,$a);
$d=array_push($b,$a);
$e=array_push($a,$b);
now i dumped these array using this
echo '<pre>';
var_dump($c);
var_dump($f);
var_dump($d);
var_dump($e);
and i get these result for every array
array(1) {
[0]=>
string(2) "aa"
}
array(1) {
[0]=>
string(2) "aa"
}
int(2)
int(1)