string is in array php code example
Example 1: php in array
$colors = array("red", "blue", "green");
if (in_array("red", $colors)) {
echo "found red in array";
}
Example 2: in_array php
<?php
$os = array("Apple", "Banana", "Lemon");
if (in_array("Apple", $os)) {
echo "Yeah. Exist Apple";
}
if (!in_array("Buleberry", $os)) {
echo "Oh, Don't Exist Blueberry!!!";
}
?>