fork download
  1. <?php
  2.  
  3. $cart['cart'] = [
  4. 123 => 5,
  5. 5521 => 1,
  6. 9001 => 10,
  7. 404 => 3
  8. ];
  9.  
  10. echo "Product\tQty\n";
  11. foreach($cart['cart'] as $product_code => $qty){
  12. echo str_pad($product_code,5," ",STR_PAD_RIGHT) . "\t$qty\n";
  13. }
  14.  
  15.  
Success #stdin #stdout 0.02s 23500KB
stdin
Standard input is empty
stdout
Product	Qty
123  	5
5521 	1
9001 	10
404  	3