php array 根据value获取key,in_array()判断是否在数组内实例

<?php
header("Content-type: text/html; charset=utf-8");

$categoryids = array ('2' => '生活','103' => '法律', '104' => '宗教', '105' => '民俗' );

$isin = in_array("法律",$categoryids);
if($isin){
    echo "in====".$isin."<br>";
    echo array_search('法律',$categoryids);
}else{
    echo "out====".$isin;
}

 

相关文章:

  • 2022-12-23
  • 2021-10-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
  • 2021-11-17
猜你喜欢
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案