Checking for an element with a particular value
<? $meals = array('A' => 1, 'B' => 4.95, 'C' => 3.00, 'D' => 6.50, 'E' => 0); $books = array("F",'G'); if (in_array(3, $meals)) { print 'There is a $3 item.'; } if (in_array('F', $books)) { print "We have F"; } // in_array() is case-sensitive if (in_array("f", $books)) { print "We have the f."; } ?>