php take a two-dimensional array of unique key for the key name. (Created by merging two arrays a new array, where the array element is a key name, another array element is key.)

// Note: The number of elements in the array keys and values arrays must be the same! 
        $ Users = Array (
             Array (
                 'ID' =>. 1, 
                'name' => 'Tom', 
                'Age' => 20 is 
            ) ,
             Array (
                 'ID' =>. 5, 
                'name' => 'anny', 
                ' Age '=> 18 is 
            ) ,
             Array (
                 ' ID '=>. 3, 
                ' name '=>' Jack ', 
                ' Age '=> 22 is 
            ) 
        );
        
         = array_combine(array_column($users, 'id'), $users);
        var_dump($users);

 

Guess you like

Origin www.cnblogs.com/weihua2018/p/11359354.html