Answers for "php verify if in array"

PHP
14

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!!!";
}
?>
Posted by: Guest on October-02-2020
3

in_array

<?php
/**
in_array ( mixed $needle , array $haystack [, bool $strict = FALSE ] ) : bool
*/

$os = array("Mac", "NT", "Irix", "Linux");
if (in_array("Irix", $os)) {
    echo "Got Irix";
}
if (in_array("mac", $os)) {
    echo "Got mac";
}
?>
Posted by: Guest on May-14-2020

Code answers related to "php verify if in array"

Browse Popular Code Answers by Language