As far as I know all arrays in php are hash arrays. Your "serial" array is actually a hash array with numeric keys, so in your example using numeric keys and having to loop through them has nothing going for it.
I'm sure someone will tell me if I'm wrong. Tim www.chessish.com <http://www.chessish.com> ---------- From: Eric McKeown [SMTP:[EMAIL PROTECTED]] Sent: 09 January 2002 05:53 To: [EMAIL PROTECTED] Subject: serial array vs. hash.... Hi folks, Quick question about the performance implications of looking up info in a hash (associative array) vs. looking it up in a serial array. I have a script that will be running a function (actually several similar functions) up to 1500 times to verify that certain data values are in a valid list. My list might have anywhere from 2 to 100 valid values. I could store the list in a conventional serial array... $valid = "Valid One"; $valid = "Valid Two"; $valid = "Valid Three"; . and so on, and then use a for loop to iterate through the contents of the array each time that I need to check to see if I have a valid value. On the other hand, I could create a hash that looks like... $valid["Valid One"] = "some value"; $valid["Valid Two"] = "some other value"; and so on, and then simply check to see if the entry exists in the associative array in order to determine whether it is valid. I suspect that the latter method would be much more efficient, and I intend to test the two techniques myself to find out, but I just thought I would check here to see if anyone could confirm or refute my hunch.... Thanks for your help, Eric -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]