The data printed by `print_ r` or `var_ dump` is very messy. Is there any way to format them?

We use print_r or var_dump to print data, which is usually as complex as the following.

clipboard.png

data

Array ( [0] => stdClass Object ( [id] => 190 [ipv4s] => Array ( ) [physical_server_buy_record] => stdClass Object ( [is_using] => [desc] => [create_time] => 2018-07-25T04:26:09.942404Z [expire_time] => 2018-07-25T04:26:09.942404Z ) [server_status] =>  [name] => SE02-B24 [desc] => [cpu] => Intel Xeon E3-1230 v5 [ram] => Supermicro DDR4___16 [disk] => Intel SSD___240 [price] => 1000.00 [pay_time] => 2018-07-25T12:26:09.841842+08:00 [expire_time] => 2018-07-26T12:11:45.841842+08:00 [ipmi_addr] => 172.16.30.216 [ipmi_account_and_pwd] => [customer_desc] => [whmcs_tblhosting_id] => [ctime] => 2018-07-02T05:11:43.176443+08:00 [uptime] => 2018-07-25T12:26:09.995883+08:00 [physical_server_model] => stdClass Object ( [id] => 8 [name] => M2 [desc] => M1SSD [cpu] => Intel Xeon E3-1230 v5 [ram] => Supermicro DDR4___16 [disk] => Intel SSD___240 [bandwidth] => ___20 [price] => 1000.00 [ctime] => 2018-06-17T04:20:57.647280+08:00 [uptime] => 2018-06-22T05:31:19.527006+08:00 ) [cabinet] => stdClass Object ( [id] => 4 [name] => SE-02 [desc] => K4-5F-2-B15-02 [ctime] => 2018-04-26T20:13:29.970901+08:00 [uptime] => 2018-04-26T20:13:29.970990+08:00 [area_partition] => stdClass Object ( [id] => 7 [name] =>  [ctime] => 2018-04-26T19:54:28.169734+08:00 [uptime] => 2018-04-26T19:54:28.169838+08:00 [area] => 3 ) ) ) ) object(Requests_Response)-sharp541 (10) { ["body"]=> string(1258) "{"count":1,"next":null,"previous":null,"results":[{"id":190,"ipv4s":[],"physical_server_buy_record":{"is_using":false,"desc":null,"create_time":"2018-07-25T04:26:09.942404Z","expire_time":"2018-07-25T04:26:09.942404Z"},"server_status":"","name":"SE02-B24","desc":"","cpu":"Intel Xeon E3-1230 v5","ram":"Supermicro DDR4___16","disk":"Intel SSD___240","price":"1000.00","pay_time":"2018-07-25T12:26:09.841842+08:00","expire_time":"2018-07-26T12:11:45.841842+08:00","ipmi_addr":"172.16.30.216","ipmi_account_and_pwd":null,"customer_desc":null,"whmcs_tblhosting_id":null,"ctime":"2018-07-02T05:11:43.176443+08:00","uptime":"2018-07-25T12:26:09.995883+08:00","physical_server_model":{"id":8,"name":"M2","desc":"M1SSD","cpu":"Intel Xeon E3-1230 v5","ram":"Supermicro DDR4___16","disk":"Intel SSD___240","bandwidth":"___20","price":"1000.00","ctime":"2018-06-17T04:20:57.647280+08:00","uptime":"2018-06-22T05:31:19.527006+08:00"},"cabinet":{"id":4,"name":"SE-02","desc":"K4-5F-2-B15-02","ctime":"2018-04-26T20:13:29.970901+08:00","uptime":"2018-04-26T20:13:29.970990+08:00","area_partition":{"id":7,"name":"","ctime":"2018-04-26T19:54:28.169734+08:00","uptime":"2018-04-26T19:54:28.169838+08:00","area":3}}}]}" ["raw"]=> string(1465) "HTTP/1.1 200 OK Vary: Accept, Cookie Allow: GET, HEAD, OPTIONS Content-Type: application/json Content-Length: 1258 X-Frame-Options: SAMEORIGIN Date: Wed, 25 Jul 2018 04:27:28 GMT Connection: close {"count":1,"next":null,"previous":null,"results":[{"id":190,"ipv4s":[],"physical_server_buy_record":{"is_using":false,"desc":null,"create_time":"2018-07-25T04:26:09.942404Z","expire_time":"2018-07-25T04:26:09.942404Z"},"server_status":"","name":"SE02-B24","desc":"","cpu":"Intel Xeon E3-1230 v5","ram":"Supermicro DDR4___16","disk":"Intel SSD___240","price":"1000.00","pay_time":"2018-07-25T12:26:09.841842+08:00","expire_time":"2018-07-26T12:11:45.841842+08:00","ipmi_addr":"172.16.30.216","ipmi_account_and_pwd":null,"customer_desc":null,"whmcs_tblhosting_id":null,"ctime":"2018-07-02T05:11:43.176443+08:00","uptime":"2018-07-25T12:26:09.995883+08:00","physical_server_model":{"id":8,"name":"M2","desc":"M1SSD","cpu":"Intel Xeon E3-1230 v5","ram":"Supermicro DDR4___16","disk":"Intel SSD___240","bandwidth":"___20","price":"1000.00","ctime":"2018-06-17T04:20:57.647280+08:00","uptime":"2018-06-22T05:31:19.527006+08:00"},"cabinet":{"id":4,"name":"SE-02","desc":"K4-5F-2-B15-02","ctime":"2018-04-26T20:13:29.970901+08:00","uptime":"2018-04-26T20:13:29.970990+08:00","area_partition":{"id":7,"name":"","ctime":"2018-04-26T19:54:28.169734+08:00","uptime":"2018-04-26T19:54:28.169838+08:00","area":3}}}]}" ["headers"]=> object(Requests_Response_Headers)-sharp544 (1) { ["data":protected]=> array(6) { ["vary"]=> array(1) { [0]=> string(14) "Accept, Cookie" } ["allow"]=> array(1) { [0]=> string(18) "GET, HEAD, OPTIONS" } ["content-type"]=> array(1) { [0]=> string(16) "application/json" } ["content-length"]=> array(1) { [0]=> string(4) "1258" } ["x-frame-options"]=> array(1) { [0]=> string(10) "SAMEORIGIN" } ["date"]=> array(1) { [0]=> string(29) "Wed, 25 Jul 2018 04:27:28 GMT" } } } ["status_code"]=> int(200) ["protocol_version"]=> float(1.1) ["success"]=> bool(true) ["redirects"]=> int(0) ["url"]=> string(69) "http://103.200.32.76:8000/api/user_productmanage/physicalserver/list/" ["history"]=> array(0) { } ["cookies"]=> object(Requests_Cookie_Jar)-sharp545 (1) { ["cookies":protected]=> array(0) { } } }

is there any way to format this data? This looks troublesome.

for example, we can post json data in json.cn to easily view the level.

Php
Mar.30,2021


/**
 * 
 * @param  array   $data  [description]
 */
function p($data, $die=1)
{
    echo "
";
    print_r($data);
    echo "
"; If ($die) die; }
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e59167-454fd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e59167-454fd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?