Quickly Code to Show All PHP Errors

Finally, I tried to work up the courage to write on the WordPress platform that I set up on my domain. I hope that I can continue to be consistent in writing anything that at least later or in the future can be useful for myself or my friends in the virtual. Hopefully, I am always eager to fill in the content here!

Background

When I am doing the coding and testing process, of course, it does not always run smoothly. Because I realized, I am still a human who can not be separated from sin. This is what causes me to have to trace what mistakes I have made in the coding process. I tried to trace it by doing debugging to find out what problem is being encountered. In this case, I use the PHP programming language. Actually, by default PHP already provides information according to what we are running, including errors in coding. However, in some cases, I cannot get error information on the system because error information is disabled for reasons of ignoring errors or for purposes in a production environment. Therefore, we can open or enable the error so that we can solve the problem.

So, what can I do with the Code?

Usually, I use the simple three lines of code below to see the error I get when debugging. I put it at the head or top of the process. Or usually, I put it in the main file (eg: index.php).

<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

Conclusion

So that is my simple way of debugging the code I am running. But you need to remember, do not ever try it in a production environment! Note that!
So what do you think about this post? Leave this message in the comments section, thank you!