I have an array
haystack[0] array (
email => 'xyz@hotmail.com'
phone => '333-333-3333'
cust_id => '1')
haystack[1] array (
email => abc@gmail.com'
phone => 444-333-5555'
cust_id => '2')
when i get a match on email address or phone I want to retrieve the cust_id?
I did this with a foreach loop and it took for ever. There are around 130,000 entries in the array.
It took about 5 minutes to do 1000 rows against the array. I will have about 1.6 million rows to process. Anyone have a good suggestion on how to do this.
Any suggestion would be great.
Validate and retrieve info Multidimension array
Moderator: General Moderators
-
trailrunner1
- Forum Newbie
- Posts: 1
- Joined: Thu Mar 10, 2011 8:54 pm
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Validate and retrieve info Multidimension array
You mean you want to search for a email address, and get it's corresponding ID?trailrunner1 wrote:when i get a match on email address or phone I want to retrieve the cust_id?
Assuming your code is well optimized, there really isn't a way to speed it up. But the answer is simple: put it into a database.trailrunner1 wrote:I did this with a foreach loop and it took for ever. There are around 130,000 entries in the array.
It took about 5 minutes to do 1000 rows against the array. I will have about 1.6 million rows to process. Anyone have a good suggestion on how to do this.