本文实例讲述了PHP自定义函数格式化json数据的方法。分享给大家供大家参考,具体如下:
<?php
/**
* Formats a JSON string for pretty printing
*
* @param string $json The JSON to make pretty
* @param bool $html Insert nonbreaking spaces and <br>s for tabs and linebreaks
* @return string The prettified output
*/
$arr = a