-5

Hello i'm trying to search in a Array like SQL with the "Like %search%" statement Has anybody an idea? I need this.

  • http://www.regular-expressions.info/ – techfoobar Sep 23 '16 at 11:50
  • 4
    duplicated question... [http://stackoverflow.com/questions/5808923/filter-values-from-an-array-similar-to-sql-like-search-using-php](http://stackoverflow.com/questions/5808923/filter-values-from-an-array-similar-to-sql-like-search-using-php) – charly3pins Sep 23 '16 at 11:52
  • there are multiple ways how to search array but it's not SQL and never will be. Without you prove what did you try or show some code we cant elp – Andurit Sep 23 '16 at 11:52

1 Answers1

0

I guess something like it can works:

function ArrayLike($search, $array)
{
  foreach ($array => $elem)
  {
    if (strstr($elem, $search) !== false)
      return (true);
  }
  return (false);
}
Victor Castro
  • 1,232
  • 21
  • 40