Web development has one major problem. It is stateless. That is, all the variables and data you have loaded in a web page is lost when you go to a new page. PHP developers use various techniques to pass variable data from one web page to another.
Because the Internet is stateless, during web development, developers constantly check and recheck variables sent to another page are the correct type, value, and got to the other page.
PHP has two built in variable checking commands that are constantly in use: print_r, and var_dump. Of course, there is also extensive use of the print, or echo, command.
The first two commands show the data in a hard-to-read format, and worse, will only output arrays, or object variables. If you put in another data type it spits out an error message, and you have to try again. This means that sometimes you use an echo when you need a print_r, or var_dump, and visa-versa. The print, or echo, command, invariably, requires extra typing to put a message with the variable your checking, so you can find it on the web page.
Not only are these commands hard-to-read and decipher, but there’s another problem, that is a time drain for a developer.
In the course of trying to debug a problem, or find out why your not getting your data, you usually use multiple print_r’s, var_dump’s, and echo’s throughout your code and across several files. The problem is removing these debugging commands when your done. The debugging commands tend to get “lost” in your code.
Getting rid of your debugging code involves going through each file, each of which may contain several hundred or thousand lines of code, in an effort to find where you put that elusive echo command that keeps popping up on your screen, a time drain.
You could use the debugger to output your variables as you step through the code, but that involves switching to debug mode in your IDE, setting breakpoints, and stepping through your code, another time drain. It’s easier to type a simple command that tells you what you want to know.
NewChk was designed to help developers with all of the above problems, provide much more information about the variables than with the traditional PHP commands, tell you what file and line you called it from, and output the information in an easy-to-read and understandable display on your web page.