in_array ( mixed $needle , array $haystack [, bool $strict = FALSE ] ) : bool
// Without strict check
echo in_array("18", $myArr); // TRUE
// With strict check
echo in_array("18", $myArr, true); // FALSE
$arr = array('php','java','python');
if ( in_array( 'java', $arr ) ) {
echo 'available';
}else{
echo 'not available';
}
// Syntax:
in_array ( mixed $needle , array $haystack , bool $strict = false ) : bool
// Example:
$fruits = array('apple', 'banana', 'orange');
in_array('apple', $fruits); // true
in_array('mango', $fruits); // false
in_array ( mixed $needle , array $haystack , bool $strict = false ) : bool
<?php
$cars = array("Maserati", "Porsche", "BMW");
echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . ".";
?>
<?php
array = ["dd"]
?>