makamo66 Posted November 11, 2019 Report Share Posted November 11, 2019 This is the cart array: $cart = array( "1" => "2", "3" => "4", "5" => "6"); var_dump($cart); array(3) { [1]=> string(1) "2" [3]=> string(1) "4" [5]=> string(1) "6" } This is the cart items array: $cart_items = array(); $cart_items["id"] = $id; $cart_items["quantity"] = $quantity; var_dump($cart_items); array(2) { ["id"]=> array(2) { [0]=> string(1) "1" [1]=> string(1) "1" } ["quantity"]=> array(2) { [0]=> string(1) "1" [1]=> string(1) "1" } } I want the key to be "id" and the value to be "quantity" like it is for the cart array. How do I define my cart_items array using variables? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.