Jump to content
Killersites Forums

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;


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...