Home  >  Article  >  Backend Development  >  In_array in php compares the same values ​​in the array and splices the arrays

In_array in php compares the same values ​​in the array and splices the arrays

小云云
小云云Original
2018-03-16 13:37:391572browse

This article mainly shares with you how in_array in PHP compares the same values ​​in the array and splices the arrays. I hope it can help you.

$right = array(1) {
  [0] => string(18) "贷后管理中心"
}
$name_ok的值
string(12) "系统设置"
string(12) "员工管理"
string(18) "贷后管理中心"
string(12) "业务管理"

Final result

{ ["daihou"]=> array(1) { ["name"]=> string(18) "Post-loan management center" }

Code

foreach ($menu_list as $k=>$v){
            $name_ok = $v['name'];
            dump($name_ok);
            if(in_array($name_ok,$right)){
                $data[$k] = $v;
            }
        }

Related recommendations:

php in_array function checks whether a certain value exists in the array

Usage of in_array function in php

10 recommended content of in_array()

The above is the detailed content of In_array in php compares the same values ​​in the array and splices the arrays. For more information, please follow other related articles on the PHP Chinese website!

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