Skip to content

Instantly share code, notes, and snippets.

@dexit
Forked from TomislavBombas/snippets.php
Created July 7, 2025 16:01
Show Gist options
  • Save dexit/c5b2a22415545849ed33c707470131d3 to your computer and use it in GitHub Desktop.
Save dexit/c5b2a22415545849ed33c707470131d3 to your computer and use it in GitHub Desktop.
Various PHP snippets #php #arrays
<?php
// parse multidimensional arrays
function parseArray($arr, $ind = "") {
$indent = "&nbsp;&nbsp;&nbsp;&nbsp;";
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