in_array() function is a control statement. : in_array « Data Structure « PHP






in_array() function is a control statement.

 
<?
$language = "French";
$languages = array ("English", "Gaelic", "Spanish");
if (in_array($language, $languages)) :
     print "$language edition.";
else :
     print "We don't yet offer a $language edition";
endif;
?>
  
  








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.Determining Whether an Element Is in an Array
4.Locating Array Elements