-
-
Save dexit/c5b2a22415545849ed33c707470131d3 to your computer and use it in GitHub Desktop.
Various PHP snippets #php #arrays
This file contains hidden or 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 | |
// parse multidimensional arrays | |
function parseArray($arr, $ind = "") { | |
$indent = " "; | |
foreach($arr as $key => $value) | |
{ | |
if (!is_array($value)) { | |
print_r($ind . $key . ": " . $value . '<br/> '); | |
} else { | |
print_r($ind . $key . ": <br/>"); | |
parseArray($value, $ind . $indent); | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment