Krumo: version 2.0 of print_r(); and var_dump();


To put it simply, Krumo is a replacement for print_r() and var_dump(). By definition Krumo is a debugging tool (initially for PHP4/PHP5, now for PHP5 only), which displays structured information about any PHP variable.

A lot of developers use print_r() and var_dump() in the means of debugging tools. Although they were intended to present human readble information about a variable, we can all agree that in general they are not. Krumo is an alternative: it does the same job, but it presents the information beautified using CSS and DHTML.

Except the collapsible DHTML tree built around the structure of the dumped PHP variable, and the improved by the CSS looks, Krumo offers additional useful features.

For example haven't been disappointed that you can not see the name of the variable passed for dumping ? Calling it many times, you will not be able to know which dump value was provided by a certain variable at a certain time in a certain place of your code. Well, Krumo can not do that either, but it offers a work- around: it prints the code line that the Krumo call was placed: in this way you can keep track of the origin of each dump you see on the screen.

Another nice addition to the set of Krumo features is the ability to turn it off. When your code gets swamped with a lot of dumping calls, instead of cleaning them up, you can just turn them off. You go to admit that this beats the alternative of going through your code and removing every dumping route you have ... right ?

A lot of times you need to dump the contents of the superglobals ($_GET, $_POST, $_SERVER, $_SESSION, etc), or see the list of included files, or the declared classes and interfaces, or the defined constants, etc. Krumo offers an easy, fast and graceful way to do this with just one simple call: see the examples area for demonstration, or just load this page to see the results.

^ back to the top of the page


In order to use Krumo you have to put it on your (development) server, and include it in your script. You can put it somewhere in the INCLUDE_PATH, or specify the full path to the class.krumo.php file.

You have to modify the krumo.ini file too. It is the configuration file for Krumo. The first option is choosing a skin:

 selected = "orange"

The value for this setting has to be the name of one of the sub-folders from the Krumo/skins/ folder. If the value provided for the skin results in not finding the skin, the `default` skin will be used instead.

The second option is used to set the correct web path to the folder where Krumo is installed. This is used in order to make the images from Krumo's CSS skins web-accessible.

 url = ""

So far those two are the only configuration options.

All the CSS files ("skin.css") from the Krumo/skins sub-folders must have the proper permissions in order to be readable from Krumo. Same applies for krumo.ini and krumo.js files.

^ back to the top of the page


Here's a basic PHP example, which will return a report on the array variable passed as argument to it:

 krumo(array('a1'=> 'A1', 3, 'red'));
  • ... (Array, 3 elements)
  • Krumo version 0.2a
    Called from /home/kinobg/, line 267  

You can dump simultaneously more then one variable - here's another PHP example:

 krumo($_SERVER, $_ENV);

You probably saw from the PHP examples above that some of the nodes are expandable, so if you want to inspect the nested information, click on them and they will expand; if you do not need that information shown simply click again on it to collapse it. Here's a PHP example to test this:

 $x1->x2->x3->x4->x5->x6->x7->x8->x9 = 'X10';

Warning: Creating default object from empty value in /home/kinobg/ on line 287
  • ... (Object) stdClass
  • Krumo version 0.2a
    Called from /home/kinobg/, line 287  

The krumo() is the only standalone PHP function from the package, and this is because basic dumps about variables (like print_r() or var_dump()) are the most common tasks such functionality is used for. The rest of the functionality can be called using static calls to the Krumo class. Here are several more PHP examples:

 // print a debug backgrace

 // print all the included(or required) files

 // print all the included functions

 // print all the declared classes

 // print all the defined constants

... and so on, etc.

For all the available features, check Krumo docs. A full PHPDocumenter API documentation exists both in this package and here, at the project's website: go and check the documentation section.

To see a PHP demonstration of most features, click here.

Another handy feature is that you can enable and disable Krumo no the fly.

 // disable Krumo

 // Krumo is disabled, nothing is printed

 // enable Krumo

 // Krumo is enable, printing is OK

This proves to be very useful when your PHP code gets swamped with Krumo calls dumping debuging information, and instead of removing each of those dumps one by one, you can just disable them.

^ back to the top of the page


There are several skins pre-installed with this package, but if you wish you can create skins of your own. The skins are simply CSS files that are prepended to the result that Krumo prints. If you want to use images in your CSS (for background, list-style, etc), you have to put %URL% in front of the image URL in order hook it up to the skin folder and make the image web-accessible.

Here's an example:

 ul.krumo-first {background: url(%url%bg.gif);}

Right now there are 4 Krumo skins (click on each to see a screenshot): default, blue, green, orange and the latest -

Feel free to contribute any new skins that you create on your own. Krumo is designed to present the PHP variable dumps in a nice and graceful way, so polishing its looks with new themes is a very important task.

^ back to the top of the page


The documentation for the Krumo project can be found inside the download packages.

To browse the site copy of Krumo docs, click here.

^ back to the top of the page


You can dowbload the latest relese of Krumo from the project's download page at To do that, use the link below:

^ back to the top of the page

Bug Tracker

For the Krumo project, we are using the tracker. If you want to report a bug, request a new feature, or you have ideas about improving the framework, use the link below:

^ back to the top of the page


For the Krumo project, we are using the forums. If you want to drop a line, use the link below:

^ back to the top of the page Logo
Krumo: Version 2.0 of print_r(); and var_dump();