在PHP中转换多维数组
// Start with this array $foo = array( 'a' => array( 1 => 'a1', 2 => 'a2', 3 => 'a3' ), 'b' => array( 1 => 'b1', 2 => 'b2', 3 => 'b3' ), 'c' => array( 1 => 'c1', 2 => 'c2', 3 => 'c3' ) ); $bar = flipDiagonally($foo); // Mystery function var_dump($bar[2]); // Desired output: array(3) { ["a"]=> string(2) "a2" ["b"]=> string(2) "b2" ["c"]=> string(2) "c2" }
flipDiagonally()
?
$foo[j][k][...][x][y][z] = $bar[z][k][...][x][y][j]
for loops
繁华开满天机
慕妹3242003
当年话下