Jump to content
Killersites Community

var_dump of an array shows just one variable

Recommended Posts

The var_dump of the $cart_items array is supposed to show an array of $cart_items with the quantities added together for the same id but it doesn't even show an array, it just shows one value.

$cart_items = $_SESSION["cart_items"];
if ( $cart_items == null ) {
    $cart_items = array();
if ( isset($_REQUEST["element_id"]) ) {
    $id = $_REQUEST["element_id"];

if ( isset($_REQUEST["quantity"]) ) {
    $quantity = $_REQUEST["quantity"];

if ( isset($id)  && isset($quantity) ) {
if (isset($cart_items[$id])) {
          $cart_items[$id] += $quantity;

} else {
    $cart_items[$id] = $quantity;


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now