If you like good one liners, here's one. You put the function on a page that you always include, in my case the menu page, and call it from anywhere below where the data is generated.
So you don't need to scour through 100 lines of source code to find an error.
Removed the last double quote near the closing script tag, but wasn't able to edit the OP. It works fine BTW, doesn't mess up you page the way echo can do.
See for more info: https://getfirebug.com/logging
You can also do that with Internet Explorer, Chrome, Safari and Opera - all of which have a full debugger built in so that you don't need an extension to handle it the way you do with Firefox.
Originally Posted by chump2877
The code on w3schools is not so much wrong as out of date because the two guys running the site haven't had time to update it. Anyway that has nothing to do with this thread.
Originally Posted by arghyajit
When i used to work with PHP this is what i and a buddy of mine found useful.