tetreum/perfect-print

Perfect print function for PHP Debugging

dev-master 2021-02-04 08:30 UTC

This package is auto-updated.

Last update: 2024-05-04 15:35:21 UTC


README

Stop wasting your time using print_r, var_dump and echo functions to debug your code. Perfect print for PHP debugging is here.

Install

composer require tetreum/perfect-print "dev-master"

Example

Having

$user = new stdClass();
$user->id = '';
$user->nick = 'luser';
$wrongJson = json_decode('ssdf');

Normal debug

echo '<pre>';
print_r($user);
var_dump($wrongJson);

Perfect print

p($user, $wrongJson);

Perfect print will automatically add and close <pre> tag for better view and also will make a separation space by using <br> or \n if you are in cli.

¡Test it yourself!

p($obj, 56, false, null, 'sdsf');