Changing a nested (multidimentional) array into key => value pairs in PHP

后端 未结 2 2077
故里飘歌
故里飘歌 2021-01-22 15:27

I have an multidimensional array that looks like this:

Array
(
    [0] => Array
        (
            [ClientID] => ec2173de2134fdsfg4fsdffcb4b5205
            [Name]         


        
2条回答
  •  灰色年华
    2021-01-22 15:38

    $flat = array();
    foreach($multidim as $item)
        $flat[$item['ClientID']] = $item['Name'];
    

    Whether you'd be better off storing the original form cannot be answered generally. You should store it if you need it.

提交回复
热议问题