<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1039876" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1039876</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/webmasters-corner/arrays-general-chat#comment-1225293</link>
    <description> &lt;p&gt;well there are a few instances this would be helpful&lt;br /&gt;
but a current project I have is a shopping cart&lt;br /&gt;
just a basic cart - adding/removing data from sessions&lt;/p&gt;
&lt;p&gt;so say you have 20 items in the DB&lt;br /&gt;
and the user clicks various things on various pages&lt;br /&gt;
each item has multiple data and not just data from the db, the user also enters input, so it cannot simply be taken from the DB on the cart page via the array&#039;s key matching the DB row ID &lt;/p&gt;
&lt;p&gt;so then you have&lt;br /&gt;
[item name]=&amp;gt; CD [price] =&amp;gt; 12.00 [artist] =&amp;gt; rolling stones [quantity] =&amp;gt; 3&lt;/p&gt;
&lt;p&gt;[quantity] is a user input&lt;br /&gt;
so when you come to display their cart (usually a table) the data is in order in the array, so a foreach or while in a limited loop&lt;br /&gt;
as above example would be 4 loops of  then a new  then the 4 loops of  again for each instant in the array (each item)&lt;/p&gt;
&lt;p&gt;but what if other items in the array have more than 4 keys per item&lt;br /&gt;
you either need to do an IF and check the key on the 5th and if not CD its something else and then loop for however many keys that item has&lt;br /&gt;
or use another array&lt;/p&gt;
&lt;p&gt;where an array with one key and multiple values under that one key would be better&lt;br /&gt;
just do a foreach on that key then it moves onto the next. doesn&#039;t matter if there are 5 values, 7 values etc&lt;br /&gt;
it will simple echo all the values for that one key, keeping all data for each item together&lt;br /&gt;
still somehow have a reference to each value in that key, like a secondary key&lt;/p&gt;
&lt;p&gt;this is just a shopping cart, but of course other curcumstances would benefit from this, especially where user input is required such as quantity coupled with different number of values/keys for different groups within the same array&lt;/p&gt;
&lt;p&gt;having an array in an array helps. so array2 is a value in array1&lt;br /&gt;
but that isnt as simple as having multiple values per key&lt;br /&gt;
again, this isn&#039;t something we can just start using, it would have to be implemented into the php structure&lt;/p&gt;
&lt;p&gt;it was just a thought really&lt;br /&gt;
I am not stuck with anything particularly, as I always find a way around stuff. Even if a little bodgy at times &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/big.png&quot; title=&quot;Laughing out loud&quot; alt=&quot;Laughing out loud&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Sat, 13 Oct 2007 14:21:26 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1225293 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/webmasters-corner/arrays-general-chat#comment-1225289</link>
    <description> &lt;p&gt;Can you give a brief example of data you are wanting to store in the array?&lt;/p&gt;
&lt;p&gt;-Greg&lt;/p&gt;
 </description>
     <pubDate>Sat, 13 Oct 2007 13:43:22 +0000</pubDate>
 <dc:creator>Greg K</dc:creator>
 <guid isPermaLink="false">comment 1225289 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
