Commit 03be92c6 authored by Romain Loth's avatar Romain Loth

easier debug when json output mode

parent dd0ab03d
<?php <?php
function echodump($title, $anyObj) { function echodump($title, $anyObj, $output_mode = "json") {
echo "<br>".$title.": "; if ($output_mode == "html") {
echo (preg_replace_callback("/\n(\s*)/", function($capt){ echo "<br>".$title.": ";
return('<br>'.str_repeat('&nbsp;', strlen($capt[0]))); echo (preg_replace_callback("/\n(\s*)/", function($capt){
}, json_encode($anyObj, JSON_PRETTY_PRINT))); return('<br>'.str_repeat('&nbsp;', strlen($capt[0])));
echo "<br>"; }, json_encode($anyObj, JSON_PRETTY_PRINT)));
echo "<br>";
}
else {
echo "\n{debug: \"".$title."\",";
echo "dump: ".json_encode($anyObj, JSON_PRETTY_PRINT)."}\n\n";
}
} }
......
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