📜  php 获取数组键之类的 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:49.498000             🧑  作者: Mango

代码示例2
//your array
    $arr1 = array (
           "y" => 35,
           "x" => 51,
           "z" => 35,
           "c_3" => 4,
           "c_1" => 54,
           "c_6" => 53,
           "c_9" => 52
    );
// Array with keys you want
    $arr2 =  array (
           "c_3" => '',
           "c_1" => '',
           "c_6" => '',
           "c_9" => ''
    );
//use array_intersect_key to find the common  ;)
    print_r(array_intersect_key($arr1,$arr2));