Created
February 26, 2022 12:40
-
-
Save TomislavBombas/8acd5aad58384fcdc5cf07c7c73408d6 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