Created
February 11, 2014 07:45
-
-
Save ZellSnippets/8930699 to your computer and use it in GitHub Desktop.
PHP: Recursively show all data of arrays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function show_data ($data) { | |
foreach ($data as $key => $value) { | |
echo '<ul style="margin-left: 20px">'; | |
if (gettype($value) == 'array' ) { | |
echo '<li>' . $key . " : " . $value . '</li>'; | |
echo '<ul style="margin-left: 20px">'; | |
show_data($value); | |
echo '</ul>'; | |
} | |
else { | |
echo '<li>' . $key . " : " . $value . '</li>'; | |
} | |
echo '</ul>'; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment