Locating Array Elements : in_array « Data Structure « PHP

Locating Array Elements

//in_array() function determines whether or not an element exists in an array, returning true if it does, 
//and false otherwise. 

//Its syntax is: bool in_array(mixed element, array array)
    $languages = array ("English", "Gaelic", "Spanish");
    $exists = in_array("Russian", $languages); 
    print $exists;
    print '<BR>';
    $exists = in_array("English", $languages); 
    print $exists;

Related examples in the same category

1.Checking for an element with a particular value
2.in_array( ) function return true if an array contains a specific value
3.in_array() function is a control statement.
4.Determining Whether an Element Is in an Array