fork download
  1. <?php
  2.  
  3. function ech($arr, $ke=NULL)
  4. {
  5. foreach($arr as $key => $value)
  6. if (!is_array($value))
  7. {
  8. $test = explode(" ",$ke);
  9. print_r($test);
  10. array_pop($test);
  11. $ke = implode(" ",$test);
  12. echo "arr $ke $key = $value \r\n";
  13. }
  14. else
  15. {
  16. $ke = "$ke ".$key;
  17. ech($value, $ke);
  18. }
  19. }
  20.  
  21.  
  22. $a = array(
  23. 'key' => 'value',
  24. 'key1' =>array(
  25. 'key11' => 'value11',
  26. 'key12' => 'value12',
  27. 'key13' => array(
  28. 'key131' => 'value131',
  29. 'key132' => 'value132')),
  30. 'key2' => 'value2'
  31. );
  32.  
  33. ech($a);
  34.  
  35. ?>
  36.  
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 
)
arr  key = value 
Array
(
    [0] => 
    [1] => key1
)
arr  key11 = value11 
Array
(
    [0] => 
)
arr  key12 = value12 
Array
(
    [0] => 
    [1] => key13
)
arr  key131 = value131 
Array
(
    [0] => 
)
arr  key132 = value132 
Array
(
    [0] => 
    [1] => key1
)
arr  key2 = value2