Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 7
    However, this will only work in one dimension. You'll have to create a recursive function in order to check each depth. Commented Nov 8, 2010 at 21:44
  • i ran the code but it has an error - Parse error: parse error in C:\wamp\www\000_TEST\php\php.in_array\index.php on line 21 - which is if(in_array("Irix", $value) thanks. Commented Nov 8, 2010 at 21:51
  • @lauthiamkok: There is a ) missing at the end of the mentioned line. Commented Nov 8, 2010 at 21:52
  • Thanks, I fixed my answer. That's what happens when I type too fast and don't reread my code. Commented Nov 8, 2010 at 21:53
  • You should always call in_array() with the third parameter set to true. Check out here why: stackoverflow.com/questions/37080581/… Commented May 16, 2016 at 8:37