Jump to content

search array


wannabe_god

Recommended Posts

with array_search you can search an array...so

<?php$array=array("test1","test2","test3");echo array_search("test2",$array);?>

will give 2.But i just want to check if "test2" is in the array $array. True or false, not a key...something like

<?php$array=array("test1","test2","test3","test4");if value_is_in_array("test5") //I don't know the functionecho "test5 is in the array"elseecho "test5 is not in the array"?>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...