Adventskalender Day 2 – PHP Debugging in Browser Console

Debugging in PHP has many functions, but it is also useful if you have a technic to debug in console of a browser. For this requirement there are a lot of libraries and enhancements. Often they are oversized and not the fastest way to reach the goal of an easy output of a variable. Debugging in UIs or on customer side is also a good point for debugging in the console. This article will demonstrate a small snippet to create a simple solution to debug PHP in a console of your browser.


I often use a simple variant, see the snippet below. I use this often for the debugging of customer problems or in a development environment to not destroy the UI. The function works in all major browsers and also with the add-on Firebug in Firefox, see the screenshots in Chrome and Firebug.

Javascript und PHP

The console use always the javascript function console() to display the content. It is easy to include this for the following function to create the output. I think it is easy to understand the function and the values for debugging will be passed with the variable $data.



The view is possible with different types, like array, string or object. Also I have include the function inside my debugging helper plugin Debug Objects for WordPress, so it is easy to use.

Be excited for tomorrow’s MarketPress Adventskalender‘s door: A litte code-snippet.

Post Sharing

Author Avatar

Alpinist, Cyclist, Optimist. I develop and support solution, primarily with SAP Business Software as Software Architect at Carl Zeiss AG and I help Companies make WordPress-based software and solutions with a great team at the Inpsyde GmbH.

Also Interesting

New Plugin: Slack Connector - Connect WordPress, WooCommerce and Slack

by Michael Firnkes

Initially we merely wanted to optimize our own Slack-processes. With automated notifications from our MarkettPress shop, the blog and our forums. The resul ...

Read more

Inpsyde is the first VIP partner in Germany

by Michael Firnkes

Automattic has given us the title of VIP Service Partner, the first in Germany, Austria and Switzerland. Worldwide, there are only eleven com ...

Read more

Inpsyde is a WooExperts Gold Partner of WooCommerce

by Michael Firnkes

A few weeks ago, Inpsyde GmbH with MarketPress became a certified WooExperts Gold Partner. This is confirmation from WooThemes of our agency’s know-h ...

Read more

BackWPup Pro: Secure WordPress Backup with Google Drive

by Michael Firnkes

The Pro version of our BackWPup plugin supports the backup of WordPress databases and files to Google Drive. But how do you set something like that up? And ...

Read more