By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,614 Members | 1,680 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,614 IT Pros & Developers. It's quick & easy.

Searching an Array

P: n/a
Is there a quick search function in PHP
to search an array to see if an element
contains a certain value?

I have an array of 1000 elements and I just
want to know if the array contains a certain
number. It needs to be as fast as possible.

Thanks,

Andrew

Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Oh, I just found the array_search() function.

Thanks anyway. :)

Andrew

Andrew wrote:
Is there a quick search function in PHP
to search an array to see if an element
contains a certain value?

I have an array of 1000 elements and I just
want to know if the array contains a certain
number. It needs to be as fast as possible.

Thanks,

Andrew


Jul 17 '05 #2

P: n/a
Andrew wrote:
Oh, I just found the array_search() function.


in_array() is the right one
greetings Christian
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.