Turn PHP var_dump To Readable Syntax Aware Text

0 Comments
Editor Ratings:
User Ratings:
[Total: 0    Average: 0/5]




This tutorial covers a simple way to turn PHP var_dump to readable syntax-aware text.

var_dump is a function in PHP that is used to dump (show) a variable data. It displays structural information about variable/expression such as type and value. This function gives recursively explored arrays and objects with values in order to show structure.

The output of a var_dump function is not easily understandable in a web browser. In order to analyze it, you have to make it syntax-aware and well-formatted. One solution to this is to use a code editor. Copy-paste the code in the editor and execute it. Another solution is way simple and saves you the extra copy-pasting step. var_masterpiece, is a PHP debugging tool that turns the var_dump to better, syntax-aware, collapsible readable text.

PHP var_dump

Also read: 5 Free Chrome Extensions To Control YouTube Playback

How To Turn PHP var_dump To Readable Syntax Aware Text?

var_masterpiece is an open source web extension that you can install to your browser. Currently, its available for Google Chrome only. You can view its source code at GitHub here. This extension works well to debug Laravel, WordPress, Yii and any other PHP framework.

var_masterpiece

After installing the extension, you can set it to autorun from the extension options. There, you can also enable “close” down cascade to make a structure collapsible. You can also define a custom styling for Int, Float, String, Bool, Array, Object and other expressions.

The below-attached screenshot shows an output of a PHP var_dump function. As you can see, the code is difficult to understand and it’s hard to differentiate between the objects.

PHP var_dump

But, with var_masterpiece, you can easily turn it into a better readable text. Now, if you enabled the autorun feature from the extension options, it will automatically change the out to readable text. Otherwise, simply select the output text and click the “var_dump here” option from the right-click context menu.

PHP var_dump

This way, you can easily turn the annoying var_dump output to better, readable text.

You can download var_masterpiece from here.

Wrap Up:

With the help of this free extension, you don’t have to deep analyze the output of the var_dump functions. This saves lots of time while debugging and makes everything less annoying.

Editor Ratings:
User Ratings:
[Total: 0    Average: 0/5]
Works With: Google Chrome
Free/Paid: Free