Home >Backend Development >PHP Tutorial >An example of php in_array usage

An example of php in_array usage

WBOY
WBOYOriginal
2016-07-25 09:00:191027browse
An example of how to use php in_array for your reference.

Sample code:

<?php
/**
* php in_array简单示例
* site bbs.it-home.org
*/
$people = array("Peter", "Joe", "Glenn", "Cleveland");

if (in_array("Glenn",$people))
  {
  echo "It's Here.";
  }
else
  {
  echo "where you going?";
  }
?>

Output: It's Here.



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn