RE: Indexing of Array

From: Date: Tue, 14 Nov 2000 01:37:19 +0000
Subject: RE: Indexing of Array
Groups: php.windows 
Request: Send a blank email to php-windows+get-3826@lists.php.net to get a copy of this message
---------------------------------------------------------------------------- ----------------- Disclaimer: The information contained in this email is intended only for the use of the person(s) to whom it is addressed and may be confidential or contain legally privileged information. If you are not the intended recipient you are hereby notified that any perusal, use, distribution, copying or disclosure is strictly prohibited. If you have received this email in error please immediately advise us by return email at postmaster@normandy.com.au and delete the email document without making a copy. ---------------------------------------------------------------------------- ----------------- I doubt your problem is your array but how you are manipulating your array. Id recommend looking for "for" loops with conters such as $i++ in them ... the best way to parse an array is a "while" loop. $ary[] = "foo"; $ary["textkey"] = 1231432; $ary[12] = 1010910; $ary[] = "The next available"; $ary[] = "key can be "; $ary[] = "set with simply "; $ary[] = "plain square brackets"; while(list($key,$value) = each($ary)){ echo "<b>$key</b> = $value <br>\n"; } So you can see you dont have to worry about what your keys are. This is great because you can then set your keys to be meaningful such as a unique product id (and maybe the value being the quantity or another array) Since you are not reliing on sequential keys you can also unset($ary[12]) and not effect anything else. Good luck mn Mark Nold markn@enspace.com <mailto:markn@enspace.com> Senior Consultant   Change is inevitable, except from vending machines. -----Original Message----- From: Mitesh Patel [mailto:mitesh@viraat.com] Sent: Saturday, November 11, 2000 12:55 PM To: php-windows@lists.php.net Subject: Indexing of Array I am facing problem with indexing of array. In shopping cart i had used the array to store the product and for displaying, now here till certain limit it was working very fine, but when the index(key) of array in which items values where stores increased greater than 9 then it is creating problem it start changing values from the index from top of that array . it stores only 10 values 0-9, i had not defined restrictions to this array for transaction between the pages i had used cookies it is cookie problem or array ??? if any one is having any soln pls reply me ..... From Mitesh

« previous php.windows (#3826) next »