Posted By

drwitt on 02/08/07


Tagged

mysql database states select sql php list html array print recursive directory


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

vali29


Get HTML list of Array Keys


 / Published in: PHP
 

  1. /**
  2.  * Creates recursively a nested HTML UL of array keys.
  3.  * @param array $array Array
  4.  * @return string Nested UL string
  5.  */
  6. function Get_Array_Keys_UL($array=array()) {
  7. $recursion=__FUNCTION__;
  8. if (empty($array)) return '';
  9. $out='<ul>'."\n";
  10. foreach ($array as $key => $elem)
  11. $out .= '<li>'.$key.$recursion($elem).'</li>'."\n";
  12. $out .= '</ul>'."\n";
  13. return $out;
  14. }
  15.  
  16.  
  17. $ul=Get_Array_Keys_UL($_POST);
  18. echo $ul;

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: czly on August 4, 2008

what?

You need to login to post a comment.