Debugging PHP in browser’s Javascript console

PHP is a server side scripting language used to develop dynamic web application. One of the limitation of PHP I see as compare to java is unlike java, php doesn’t have a good server side debugging feature. All we can do for debugging in PHP us just add some echo, var_dump etc statements that will show variable, array values on browser screen.

We all know that today’s web browser has a very good console logging mechanism which I have used to create a simple and very handy PHP class for displaying variable, arrays values on browser console by using javascript. This simple PHP class has four trace levels info, warn, log, error which developer can use to display variable, arrays values on browser console.

Now import the WebConsole class and use the tracing functions.

Now check your Web Browser console. You will find the out put similar to following screenshot.

About the Author

has written 69 posts.

I Love Coding, Analyzing, Designing and doing it the right way. I am obsessed about learn anything new daily and sharing what I have learn each Day. This Blog is journey of my Zeal, going through step by step to the mountain of desire to become prefect. Google Wanna Hire me ?

Copyright © 2020 All rights reserved.
Proudly powered by WordPress. Developed by 7Tech Solutions