Home > Backend Development > PHP Tutorial > 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

小云云
Release: 2023-03-21 15:36:01
Original
1618 people have browsed it

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) "贷后管理中心"
}
Copy after login
$name_ok的值
string(12) "系统设置"
string(12) "员工管理"
string(18) "贷后管理中心"
string(12) "业务管理"
Copy after login

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;
            }
        }
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template