“in_array” Kode Jawaban

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";
}
?>

Matteoweb

in_array

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

if (in_array("Glenn", $people))
  {
  echo "Match found";
  }
else
  {
  echo "Match not found";
  }
?>
Shiny Stag

Jawaban yang mirip dengan “in_array”

Pertanyaan yang mirip dengan “in_array”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya