Support » Developing with WordPress » 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 to see the link]

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    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)
  • You must be logged in to reply to this topic.