Display a nested session variable in PHP

  php, session-variables

I’m trying to echo product_name with

echo $_SESSION["shopping_cart"]["product_name"];

but that’s not working.

This is var_dump($_SESSION)

array(4) {
  ["shopping_cart"]=>
  array(1) {
    [0]=>
    array(4) {
      ["product_id"]=>
      string(2) "99"
      ["product_name"]=>
      string(32) "Booster Juice Concentrate"
    }
  }

How can I echo "product_name"?

TIA

Source: Ask PHP

LEAVE A COMMENT