Home  >  Article  >  Backend Development  >  求解三维数据变二维数组解决思路

求解三维数据变二维数组解决思路

WBOY
WBOYOriginal
2016-06-13 13:52:11892browse

求解三维数据变二维数组
此类数组
array (0 => array ('吖' => array (0 => 'a',1 => 'a')),1 => array ('阿' => array (0 => 'a',1 => 'a')))
如何变成
array ('吖' => array (0 => 'a',1 => 'a'),'阿' => array (0 => 'a',1 => 'a'))

------解决方案--------------------

PHP code
$ar = array (0 => array ('吖' => array (0 => 'a',1 => 'a')),1 => array ('阿' => array (0 => 'a',1 => 'a')));
foreach($ar as $v)
 $r[key($v)] = current($v);
print_r($r); <div class="clear">
                 
              
              
        
            </div>
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