View Single Post
  #4  
Old 12th April 2013, 20:27
sjau sjau is offline
Local Meanie
 
Join Date: Apr 2006
Location: Switzerland
Posts: 1,138
Thanks: 4
Thanked 53 Times in 49 Posts
Default

I know I'm a bit late, but I like this function to display arrays:

Code:
function displayArray($aArray)
{
    if (is_array($aArray) && (count($aArray) > 0))
    {
        print("<table border=1>");
        print("<tr><th>Key</th><th>Value</th></tr>");
            foreach ($aArray as $aKey => $aValue)
            {
                print("<tr>");
                if (!is_array($aValue))
                {
                    if (empty($aValue))
                    {
                        print("<td>$aKey</td><td><i>$aValue</i></td>");
                    } else {
                        print("<td>$aKey</td><td>$aValue</td>");
                    }
                } else {
                    print("<td>$aKey(array)</td><td>");
                    displayArray($aValue);
                    print("</td>");
                }
                print("</tr>");
            }
        print("</table>");
    } else {
        print("<i>empty or invalid</i>");
    }
}
__________________
"Common sense is not as common as commonly believed" by sjau

Auto-Install Script for ISPConfig and Horde on a Vanilla Debian Stable

Need more Repos for Ubuntu? Repository Generator
Need more Repos for Debian? Debian Repository Generator
Reply With Quote