user1114
0
Q:

php array has value

<?php
$people = array("Peter", "Joe", "Glenn", "Cleveland");
if (in_array("Glenn", $people)){
	echo "Match found";
}
else{
	echo "Match not found";
}
?>
8
$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
11
<?php
$os = array("Mac", "NT", "Irix", "Linux");
if (in_array("Irix", $os)) {
    echo "Existe Irix";
}
if (in_array("mac", $os)) {
    echo "Existe mac";
}
?>
5

<?php

$people = array("Peter", "Joe", "Glenn", "Cleveland");



if (in_array("Glenn", $people))

  {

  echo "Match found";

  }

else

  {

  echo "Match not found";

  }

?>
 
3
if (!empty($data_days) && in_array(1, $data_days, true)){ // use numeric value 1, not string
2

<?
in_array("Irix", $os);
?>

2

New to Communities?

Join the community