Home/Tools/PHP print_r Formatter

PHP Debugging Tools

PHP print_r Formatter

Clean up PHP print_r output so arrays and nested values are easier to scan.

Formatted output

Array
(
    [name] => Ada
    [roles] => Array
    (
        [0] => admin
        [1] => editor
    )
)

Use this formatter when copied print_r() output is compressed onto one line and hard to read.

PHP example

echo '<pre>';
print_r($value);
echo '</pre>';

Common mistakes

print_r() is readable but loses type detail. Use var_dump() or structured logging when types matter.

FAQ

Does this parse every print_r output?

It formats common inline print_r output and is intended as a quick readability helper.

Should print_r be used in production?

No. Use structured logging and remove direct debug output from production responses.

Related tools

Related guides