Title: check if string exists in array
Last modified: September 26, 2019

---

# check if string exists in array

 *  [Revenco Vladislav](https://wordpress.org/support/users/revenco-vladislav/)
 * (@revenco-vladislav)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/check-if-string-exists-in-array/)
 * Hello, I make search for one pharmaceutic company, that have 10 000 codes like
   this:
 * 3bktzgo4
    2ltold4k l4u93l4r sm9yngpj
 * I need to visitor when search one of code, if code exist in database to be written
   that product is valid, else, if code do not exist, to be shown that product is
   counterfeit.
 * Does anyone know how to make it, with php, or js or with some plugin, in the 
   simplest way?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcheck-if-string-exists-in-array%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/check-if-string-exists-in-array/#post-11973586)
 * Are 10,000 co0des really maintained in a single PHP array? If so, you could use`
   in_array()` to search for a match. I’m a bit skeptical that you have a 10,000
   element array. If the code data is maintained in another format, different techniques
   can be used to search. The correct technique depends on how the codes are actually
   stored.

Viewing 1 replies (of 1 total)

The topic ‘check if string exists in array’ is closed to new replies.

## Tags

 * [check](https://wordpress.org/support/topic-tag/check/)
 * [validation](https://wordpress.org/support/topic-tag/validation/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [6 years, 8 months ago](https://wordpress.org/support/topic/check-if-string-exists-in-array/#post-11973586)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
