//在yii2中,在类里面的函数,可以不加action
$arr = array( array('a', 'b'), array('c', 'd') ); in_array('a', $arr); // 此时返回的永远都是 false deep_in_array('a', $arr); // 此时返回 true 值 function deep_in_array($value, $array) { foreach($array as $item) { if(!is_array($item)) { if ($item == $value) { return true; } else { continue; } } if(in_array($value, $item)) { return true; } else if(deep_in_array($value, $item)) { return true; } } return false; }

 

相关文章:

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