Are you tired of having countless errors on your code? If yes, then this article is for you. I’m gonna share the best tips in debugging your code and also checking for errors in your code. So keep on reading.

What is debugging?

I’m sure you were thinking about bugs or insects, lol.. debugging in programming actually means finding and fixing errors in your code so it can be executed by your compiler or the browser in the case of front end languages like JavaScript. These errors are reffered to as “bugs” which are very annoying in most cases.

In order to effectively find these bugs, here are some few steps to take.

We’ll be using php for our examples, but you can apply the same steps for any web development language.

Php debugging techniques.

1). Print things alot

This is my favourite step in searching for errors in code. When ever I write a long block of code and there seems to be an error somewhere, I always use an if/else statement at different checkpoints  and print a success message on the screen. I name those checkpoints block 1, block 2 and block 3 respectively. For example.

//code block goes here.
if(condition to check if block 1 works){

echo "block 1 works";


if(condition to check if block 2 works){

echo "block 2 works";


You can continue writing these conditions¬† for as many blocks in your code and then run your code. If there are 5 checkpoints in your code and only 2 success message is printed, then you’ll know that your error is in block 3 which you can now narrow your search for the bug in block 3. You can continue this step till all the bugs have been fixed.

2.) Use the inspect tool on the browser.

In several cases where backend programming is needed e.g php and python, we can use backend programming codes to generate html and JavaScript codes which will be sent to the browser for further execution. Most times, when the code is not running as expected, you can inspect the code using your browser to see if the correct html code was generated or if there are client side scripting errors (JavaScript errors). Open the inspect tool by pressing “Ctrl + shift + I” in the browser then open the console tab for client side errors or the sources tab to check the generated code. This is another effective debugging practice in web development which can save you alot of stress.

3.) Read error messages carefully.

Most times, when there’s a critical error in your code, your browser or text editor always highlight the error and displays it for you with it’s line number for easy debugging with a suggestion on how to fix it. Some good text editors also have this features like visual studio code, atom, sublime text and the rest. It is important to read and understand these errors in order to fix them immediately. Most JavaScript errors are usually shown on the console so it’s expected that you inspect your console Everytime for some bugs.

4.) Take your time off and relax.

Most times due to fatigue from long term coding, you’re likely to make mistakes either in your spellings or algorithms. Always make sure you take your break for 15 minutes or more. You can take a walk, watch a good movie or even a nap which can help you relax your brain. You can also get more ideas while resting.

5) Stay up to date with the latest hard and software technologies.

Sometimes, you might recieve errors in your code due to new features which your device or browser (In the case of web developers), do not support yet. These errors can be avoided by constant updating of your softwares to the latest features. Most softwares offer an option for automatic update which is recommended to avoid these errors. Its always advisable to check the requirements of the update before installing it to prevent a system crash. See the features and minimum requirements for the latest version of Windows here .

That’s all I have for now. I’ll continue to update this post with more debugging practices in the future. Feel free to subscribe to our newsletter or follow us on any of our social media handles.

You can also send us an email for a private reply. Our address is

Your favorite web developers.

vic okeke

I'm just a web developer hoping to help out junior developers in algorithms for their projects.


Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *