ok, can someone explain to me why emptying one session var empties a separate one??
here's the code
echo "\ncart going into session\n";
print_r($ec_cart);
// serialize is necessary to make a copy of the cart
$_SESSION['purchase_cart'] = serialize($ec_cart);
echo "\ncontents of purchase_cart\n";
print_r($_SESSION['purchase_cart']);
$_SESSION['purchase_total'] = $cart_total;
// empty old car vars
$_SESSION['ec_cart'] = NULL;
$_SESSION['cart'] = NULL;
echo "\nsession cart after nullified session\n";
print_r($_SESSION['purchase_cart']);
die("die time");
Here's the output:
cart going into session
Array
(
[new_7_44c6c40a2b9eb] => Array
(
[type] => new
[pkg_opt_id] => 7
[extra_time] => 5
[pkg_type] => gold
[pkg_name] => Gold
[max_pictures] => 3
[price] => 1.99
[additional] => 1.99
[name] => Adfotos Gold, 3 photos
)
)
contents of purchase_cart
a:1:{s:19:"new_7_44c6c40a2b9eb";a:9:{s:4:"type";s:3:"new";s:10:"pkg_opt_id";s:1:"7";s:10:"extra_time";s:1:"5";s:8:"pkg_type";s:4:"gold";s:8:"pkg_name";s:4:"Gold";s:12:"max_pictures";s:1:"3";s:5:"price";s:4:"1.99";s:10:"additional";s:4:"1.99";s:4:"name";s:22:"Adfotos Gold, 3 photos";}}
session cart after nullified session
die time
I vaguely recall something about array contents being passed by reference, but a serialized array? I don't understand 🙁