$fruits = ['Apple', 'Orange', 'Banana', 'Grapes'];

if (in_array('Banana', $fruits)) {
    echo 'Banana was found in the array!';
} else {
    echo 'Banana was not found in the array.';
}

// Output: 'Banana was found in the array!'
in_array(mixed $needle, array $haystack[, bool $strict = false]): bool
$fruits = ['apple', 'orange', 'banana', 'grape'];
$search_values = ['banana', 'grape', 'watermelon']; // List of values to search for

foreach ($search_values as $value) {
    if (in_array($value, $fruits)) {
        echo "Found '{$value}' in the array!" . '<br>';
    } else {
        echo "Did not find '{$value}' in the array." . '<br>';
    }
}
Output:
$supported_languages = ['en', 'es', 'fr', 'de'];

$user_language = 'fr';

if (in_array($user_language, $supported_languages)) {
    echo "The selected language '{$user_language}' is supported!";
} else {
    echo "The selected language '{$user_language}' is not supported. Using default language.";
}
Output:
$numbers = [1, 2, 2, 3, 4, 4, 5];
$unique_numbers = [];

foreach ($numbers as $number) {
    if (!in_array($number, $unique_numbers)) {
        $unique_numbers[] = $number;
    }
}

print_r($unique_numbers);
Output:
$valid_colors = ['red', 'green', 'blue', 'yellow'];
$user_color = 'orange';

if (in_array($user_color, $valid_colors)) {
    echo 'The selected color is valid!';
} else {
    echo 'The selected color is not allowed.';
}
Output:
$fruits = ['apple', 'orange', 'banana', 'grape'];

if (in_array('orange', $fruits)) {
    echo 'Orange found! Make some orange juice!';
} else {
    echo 'No orange found. Time to buy some!';
}
Output: