From 8b854b73850de1bd97afa1f776cfeaf9c5e7d236 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Sun, 29 Apr 2012 10:06:13 +0200 Subject: [PATCH] Improved spacing in pretty_dump --- frontend/cphp/include.misc.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/cphp/include.misc.php b/frontend/cphp/include.misc.php index b43fe11..06533b7 100644 --- a/frontend/cphp/include.misc.php +++ b/frontend/cphp/include.misc.php @@ -98,10 +98,19 @@ function clean_array($arr) function pretty_dump($input) { ob_start(); + var_dump($input); + $output = ob_get_contents(); ob_end_clean(); - $output = nl2br(str_replace(" ", "   ", $output)); + + while(preg_match("/^[ ]*[ ]/m", $output) == 1) + { + $output = preg_replace("/^([ ]*)[ ]/m", "$1   ", $output); + } + + $output = nl2br($output); + echo($output); }