Return to Snippet

Revision: 2394
at February 9, 2007 14:37 by drwitt


Updated Code
/**
 * Creates recursively a nested HTML UL of array keys.
 * @param array $array Array
 * @return string Nested UL string
 */
function Get_Array_Keys_UL($array=array()) {
 $recursion=__FUNCTION__;
 if (empty($array)) return '';
 $out='<ul>'."\n";
 foreach ($array as $key => $elem)
   $out .= '<li>'.$key.$recursion($elem).'</li>'."\n";
 $out .= '</ul>'."\n";  
 return $out;
}


$ul=Get_Array_Keys_UL($_POST);
echo $ul;

Revision: 2393
at February 8, 2007 04:50 by drwitt


Initial Code
/**
 * Creates recursively a nested HTML UL of array keys.
 * @param array $array Array
 * @return string Nested UL string
 */
function Get_Array_Keys_UL($array=array()) {
 $recursion=__FUNCTION__;
 if (empty($array)) return '';
 $out='<ul>'."\n";
 foreach ($array as $key => $elem)
   $out .= '<li>'.$key.$recursion($elem).'</li>'."\n";
 $out .= '</ul>'."\n";  
 return $out;
}


$ul=Get_Array_Keys_UL($_POST);
echo $ul;

Initial URL

                                

Initial Description

                                

Initial Title
Get HTML list of Array Keys

Initial Tags
mysql, database, sql, php, list, html, array, directory

Initial Language
PHP