<?php $people = array("Peter", "Joe", "Glenn", "Cleveland"); if (in_array("Glenn", $people)){ echo "Match found"; } else{ echo "Match not found"; } ?>
$myArr = [38, 18, 10, 7, "15"]; echo in_array(10, $myArr); // TRUE echo in_array(19, $myArr); // TRUE // Without strict check echo in_array("18", $myArr); // TRUE // With strict check echo in_array("18", $myArr, true); // FALSE
<?php $os = array("Mac", "NT", "Irix", "Linux"); if (in_array("Irix", $os)) { echo "Existe Irix"; } if (in_array("mac", $os)) { echo "Existe mac"; } ?>
<?php $people = array("Peter", "Joe", "Glenn", "Cleveland"); if (in_array("Glenn", $people)) { echo "Match found"; } else { echo "Match not found"; } ?>
if (!empty($data_days) && in_array(1, $data_days, true)){ // use numeric value 1, not string
<? in_array("Irix", $os); ?>