i have a multi array that looks like this.
$_SESSION['cartItems']['quantity']
how do i print out its values? print_r wont work. unless i sessions dont work with multi arrays?
i have a multi array that looks like this.
$_SESSION['cartItems']['quantity']
how do i print out its values? print_r wont work. unless i sessions dont work with multi arrays?
you can use var_dump($_SESSION). However, print_r should work. Make sure you are doing print_r($_SESSION), and not trying to print_r your variable that may not exist.
If you want to get the quantity of each card item in the array, you can do this:
$quantities = array_map(create_function('item', "$item['quanitity']"), $_SESSION['cardItems']);
// PHP 5.3
$quantities = array_map(function($item) {
return $item['quanitity'];
}, $_SESSION['cardItems']);