[eluser]Fielder[/eluser]
Code:
echo 'Before merge: start';
var_dump($storeArray[2975]);
echo 'end';
$subTotal = $this->rtui_app->subTotal($storeArray);
$storeArray = array_merge($storeArray, $subTotal);
echo 'After merge: start';
var_dump($storeArray[2975]); // This is line 360
echo 'end';
foreach ($stores as $row)
{
if (!isset($storeArray[$row['store_id']]))
{
$storeArray[$row['store_id']] = array(
'storename' => $row['storename_name'],
'storenum' => $row['store_number'],
'newAd_count' => '0',
'renewAd_count' => '0',
'totAd_count' => '0',
'spaces_count' => '0',
'print' => 'N',
'lastqtrAd_count' => '0',
'cancelled' => '0',
'freeAd_count' => '0',
'revenue' => '$ '.number_format(0, 2)
);
}
}
echo 'After foreach Loop: start';
var_dump($storeArray[2975]);
echo 'end';
Quote:Before merge: startarray(11) { ["storename"]=> string(9) "Appletree" ["storenum"]=> string(3) "736" ["newAd_count"]=> int(4) ["renewAd_count"]=> int(4) ["totAd_count"]=> int(8) ["spaces_count"]=> int(10) ["print"]=> string(1) "Y" ["lastqtrAd_count"]=> int(9) ["cancelled"]=> int(1) ["freeAd_count"]=> int(4) ["revenue"]=> string(10) "$ 5,115.87" } endAfter merge: start
A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 2975
Filename: controllers/all_search.php
Line Number: 360
NULL endAfter foreach Loop: startarray(11) { ["storename"]=> string(9) "Appletree" ["storenum"]=> string(3) "736" ["newAd_count"]=> string(1) "0" ["renewAd_count"]=> string(1) "0" ["totAd_count"]=> string(1) "0" ["spaces_count"]=> string(1) "0" ["print"]=> string(1) "N" ["lastqtrAd_count"]=> string(1) "0" ["cancelled"]=> string(1) "0" ["freeAd_count"]=> string(1) "0" ["revenue"]=> string(6) "$ 0.00" } end
So before merge, 2975 is there.
After merge, 2975 is not there.
But after the foreach loop, it adds back in 2975 because it is in $stores.