Home >Backend Development >PHP Tutorial >PHP uses the array_search function to implement array search, array_search array_PHP tutorial

PHP uses the array_search function to implement array search, array_search array_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 09:51:01983browse

php uses the array_search function to implement array search, array_search array

The example in this article describes how php uses the array_search function to implement array search. Share it with everyone for your reference. The specific implementation method is as follows:

<&#63;php
$array = array(4,5,7,8,9,10); 
$found = array_search(8, $array);
//调用array_search函数并输出查找结果 
if($found) //如果找到输出键 
  echo "已找到,键为".$found; 
else //如果没有找到输出错误信息 
  echo "没有找到"; 
&#63;>

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1015426.htmlTechArticlephp uses the array_search function to implement array search. array_search array This article describes how PHP uses the array_search function to implement array search. method. Share it with everyone for your reference...
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