473,326 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Searching an Array

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
2 1664
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
Andrew wrote:
Oh, I just found the array_search() function.


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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Sims | last post by:
Hi, Given a string $txt and an array of strings $txt_array what would be the best/fastest way to search in _insensitive_ case if $txt is in $text_array and, if it is, where is it? Because I...
3
by: hivie | last post by:
I have a problem that is causing me problems. I have a text file that stores 5 lines of crap (stuff that I dont need( for the user only)). After that there is data that is in three columns...
5
by: Alan Mackenzie | last post by:
I've recently moved onto a C++ project with a large number of directories (several hundred) containing an even larger number of C++ source files. There are vastly more ways in C++ to obfuscate a...
1
by: romain.jouin | last post by:
Hi everyone, I just wanted to propose this piece of code which is searching recursively a value in an array... and let you indicate me if there is an error... function...
6
by: Bernie Yaeger | last post by:
I need a little help with an algorithm. Let's say I have an array with 15 items. I want to find "Fern" where there are "Able", "Me Also", "Zimmerman", etc in no particular order. Forget about...
2
by: Carlos K | last post by:
Hello I'm having some difficulty searching a set of rows in a DataRow collection.. This is my question What would be an efficient way to search any column of an DataRow array Let me try to...
33
by: Geoff Jones | last post by:
Hiya I have a DataTable containing thousands of records. Each record has a primary key field called "ID" and another field called "PRODUCT" I want to retrieve the rows that satisy the following...
3
by: Aaron | last post by:
I'm trying to parse a table on a webpage to pull down some data I need. The page is based off of information entered into a form. when you submit the data from the form it displays a...
5
by: lemlimlee | last post by:
hello, this is the task i need to do: For this task, you are to develop a Java program that allows a user to search or sort an array of numbers using an algorithm that the user chooses. The...
3
by: jac130 | last post by:
the program runs, and user is prompted via inputbox to enter an integer-this is the size of the array, then the user fills the array with that many values...but as the user enters the values, i need...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.