How to Enable PHP Error Reporting

Errors are undesirable for users and you should do everything in your control to keep users away from them. However, they are of utmost importance for developers. They allow developers to understand the inaccuracies and vulnerabilities in their code by alerting them...

How to Convert a String to a Number in PHP

PHP is a weakly typed language. This means that when initializing a variable in PHP, one doesn’t need to declare the variable type. PHP implicitly declares a data type for your variable. This can save you from prospective type errors in your code. When working...

PHP Memory Leaks, How to Find and Fix Them

Memory leaks can happen in any language, including PHP. These memory leaks may happen in small increments that take time to accumulate, or in larger jumps that manifest quickly. Either way, if your app has a memory leak, sooner or later it will cause problems. The...

PHP Json_encode: Serialize PHP Objects to JSON

PHP is a server-side scripting language for creating your website’s backend system that can serve webpages, communicate with databases, and exchange data over the internet. A decent backend framework like PHP needs to be capable of providing and processing data...

Tutorial: Log to Console in PHP

“All code and no logging makes John a black box error-prone system.”  Logging is a key aspect of monitoring, troubleshooting and debugging your code. Not only does it make your project’s underlying execution more transparent and intelligible,...

Programmatically Adding Laravel Middleware

When it comes to web development, middleware is often the key to ensuring everything connects up – even if some of the pieces don’t always match up. HTTP Middleware is a mechanism used to conveniently filter HTTP requests coming into your web...