So I'm trying to use a foreach loop to echo out all the values of an array in my $_SESSION array as follows.
<?php
foreach($_SESSION['movie'] as $key => $value){
echo "Movie: " . $key;
}
foreach($_SESSION['session'] as $key => $value){
echo "Session: " . $key;
}
?>
I'm pretty new to PHP so don't have much idea if I'm even on the right track.
This is the var_dump of the $_SESSION array.
array(1) {
["cart"]=> array(2) {
["ACWED-09"]=> array(3) {
["movie"]=> string(2) "AC"
["session"]=> string(6) "WED-09"
["seats"]=> array(1) { ["SF"]=> int(7) }
}
["ACFRI-09"]=> array(3) {
["movie"]=> string(2) "AC"
["session"]=> string(6) "FRI-09"
["seats"]=> array(1) { ["SF"]=> int(2) }
}
}
}
var_dump$_SESSION['movie']there. You have$_SESSION['cart']['ACWED-09']['movie']and it contains the string"AC", not an array.