Array( [id] => 60179 [pid] => 60071 [name] => 13666520868 [children] => Array ( [60225] => Array ( [id] => 60225 [pid] => 60179 [name] => 13587283707 ) [60226] => Array ( [id] => 60226 [pid] => 60179 [name] => 13511265626 ) [60230] => Array ( [id] => 60230 [pid] => 60179 [name] => 15088323701 [children] => Array ( [60234] => Array ( [id] => 60234 [pid] => 60230 [name] => 13967187282 ) ) ) [60383] => Array ( [id] => 60383 [pid] => 60179 [name] => 13819296086 [children] => Array ( [60384] => Array ( [id] => 60384 [pid] => 60383 [name] => 18305721297 ) ) ) ))
Array( [id] => 60179 [pid] => 60071 [name] => 13666520868 [children] => Array ( [0] => Array ( [id] => 60225 [pid] => 60179 [name] => 13587283707 ) [1] => Array ( [id] => 60226 [pid] => 60179 [name] => 13511265626 ) [2] => Array ( [id] => 60230 [pid] => 60179 [name] => 15088323701 [children] => Array ( [0] => Array ( [id] => 60234 [pid] => 60230 [name] => 13967187282 ) ) ) [3] => Array ( [id] => 60383 [pid] => 60179 [name] => 13819296086 [children] => Array ( [0] => Array ( [id] => 60384 [pid] => 60383 [name] => 18305721297 ) ) ) ))
$a = array ( 'id' => '60179', 'pid' => '60071', 'name' => '13666520868', 'children' => array ( 60225 => array ( 'id' => '60225', 'pid' => '60179', 'name' => '13587283707', ), 60226 => array ( 'id' => '60226', 'pid' => '60179', 'name' => '13511265626', ), 60230 => array ( 'id' => '60230', 'pid' => '60179', 'name' => '15088323701', 'children' => array ( 60234 => array ( 'id' => '60234', 'pid' => '60230', 'name' => '13967187282', ), ), ), 60383 => array ( 'id' => '60383', 'pid' => '60179', 'name' => '13819296086', 'children' => array ( 60384 => array ( 'id' => '60384', 'pid' => '60383', 'name' => '18305721297', ), ), ), ),);function foo(&$ar) { if(! is_array($ar)) return; foreach($ar as $k=>&$v) { if(is_array($v)) foo($v); if($k == 'children') $v = array_values($v); }}foo($a);print_r($a);
Array( [id] => 60179 [pid] => 60071 [name] => 13666520868 [children] => Array ( [0] => Array ( [id] => 60225 [pid] => 60179 [name] => 13587283707 ) [1] => Array ( [id] => 60226 [pid] => 60179 [name] => 13511265626 ) [2] => Array ( [id] => 60230 [pid] => 60179 [name] => 15088323701 [children] => Array ( [0] => Array ( [id] => 60234 [pid] => 60230 [name] => 13967187282 ) ) ) [3] => Array ( [id] => 60383 [pid] => 60179 [name] => 13819296086 [children] => Array ( [0] => Array ( [id] => 60384 [pid] => 60383 [name] => 18305721297 ) ) ) ))
神様、ありがとう、素晴らしいですね