Commit ac8fec54 authored by Mac Newbold's avatar Mac Newbold

Add a handy function to recursively print the contents of an array.

parent d639bd53
...@@ -313,6 +313,22 @@ function LASTNODELOGIN($node) ...@@ -313,6 +313,22 @@ function LASTNODELOGIN($node)
{ {
} }
#
# A function to print the contents of an array (recursively).
# Mostly useful for debugging.
#
function ARRAY_PRINT($arr) {
if (!is_array($arr)) { echo "non-array '$arr'\n"; }
foreach ($arr as $i => $val) {
echo("'$i' - '$val'\n");
if (is_array($val)) {
echo "Sub-array $i:\n";
array_print($val);
echo "End Sub-array $i.\n";
}
}
}
# #
# Beware empty spaces (cookies)! # Beware empty spaces (cookies)!
# #
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment