With the help of in_array() function we can check any element is exists in array or not. It's return type is true when element is exists and false when an element is not exists in array.

Syntax

in_array(search,array,type)

BY Best Interview Question ON 26 Jun 2019

Example

$array = array("Best", "Interview", "Questions");
if (in_array("Interview", $array))
{
echo "Element exists in array";
}
else
{
echo "Element not exists in array";
}