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?