vassili Posted February 14, 2008 Share Posted February 14, 2008 i have this array $cartSizes[$productid] where $productid is an array of 8 values (1-. $cartSizes is stored in a $_SESSION array like this $_SESSION['cartSizes'] = $cartSizes; an example of a $_SESSION['cartSizes'] array that has 2 $productid would be: [cartSizes] => Array ( [8061ABL] => Array ( [1] => 0 [2] => 3 [3] => 4 [4] => 5 [5] => 0 [6] => 0 [7] => 0 [8] => 0 )[6105AAOAU] => Array ( [1] => 3 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 ) ) i want to get the sum of $_SESSION['cartSizes']. but this doesn't work...i keep getting "0". sum_array($_SESSION['cartSizes']) what's wrong? Quote Link to comment https://forums.phpfreaks.com/topic/91035-array_sum-with-multidimensional-_session-arrays/ Share on other sites More sharing options...
Psycho Posted February 14, 2008 Share Posted February 14, 2008 You can't store an array as a session value directly. Try serialize() and unserialize(). Quote Link to comment https://forums.phpfreaks.com/topic/91035-array_sum-with-multidimensional-_session-arrays/#findComment-466617 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.