I used array_merge_recursive on the arrays below:
Array ( [111-23456-789] => 0 [2380600] => 1963 [8123123] => 0...)
Array ( [111-23456-789] => 0 [2380600] => 3860 [8123123] => 0...)
note: Because array_merge_recursive works on string keys, the keys for the arrays above are actually string-type values of another array. Also, the array is actually bigger than this hence the '...' before the end brackets of the arrays.
Expected output (from what I understand in the W3Schools.com and php.net):
Array ( [111-23456-789] => Array ( [0] => 0 [1] => 0 ) [2380600] => Array ( [0] => 1963 [1] => 3860 ) [8123123] => Array ( [0] => 0 [1] => 0 )...)
Instead I get this nonsense:
Array ( [111-23456-789] => Array ( [0] => 0 [1] => 0 ) [0] => 1963 [1] => 0 [2] => 365...)
Below is how I got my array of keys:
while ($nrows = mysqli_fetch_assoc($resultSetNames)) {
$name = $nrows['name'];
array_push($arrayNamesRes, "$name");
}
This is how I made my first associative array:
$nov = 0;
while ($novrows = mysqli_fetch_assoc($resultSetNov)) {
$counter = $novrows['count(playsms_tblsmsoutgoing.uid)'];
$arrayNovRes[$arrayNamesRes[$nov]] = $counter;
$nov++;
}
...and my second associative array:
$dec = 0;
while ($decrows = mysqli_fetch_assoc($resultSetDec)) {
$counter = $decrows['count(playsms_tblsmsoutgoing.uid)'];
$arrayDecRes[$arrayNamesRes[$dec]] = $counter;
$dec++;
}
What can I do to get my expected output? I'm still new at using stackoverflow. If this post is too vague please state so. Thank you in advance.