php - Display array elements in a specific way -


I am making sessions based shopping cart systems, and I need some help to display an array from session. My array looks like this:

  array (5) {[0] => NULL [1] = & gt; String (5) "TMRS1" [2] = & gt; String (5) "TMRS2" [3] = & gt; String (5) "TMRS1" [4] = & gt;  

I want a script to calculate duplicate elements and display them.

For example, set TMRS1 to $ name1 (= TMRS1) and $ volume1 (= 2) Will be done. The next item will then be $ name2 and $ quantity2 and so on.

Is this possible? If you can display items in the cart, after posting better, you may be more than welcome to post. I just need to be able to draw some data from the database using the name of the data, and then add all the values ​​of the item :)

Comments