PHP in_array() function with example

 10 - Mar - 2022
 XpertPhp
 115

In this article, We will explain to you PHP in_array() function with example.

PHP in_array() function

The in_array() function is a built-in function of PHP. which is used to check the specific value available or not in the array. so you can see our PHP array Function example.

Syntax

in_array(search, array, type);

Example

<?PHP
$arr = array("jay", "om", "deep");

if (in_array("om", $arr))
  {
  echo "Match found";
  }
else
  {
  echo "Match not found";
  }
?>

Output

Match found