PHP – Constructor Property Promotion

In PHP 8, the constructor property promotion is a feature that was added that reduces the amount of code that needs to be typed for working with constructor properties. This feature can be beneficial by reducing the amount of typing that is needed to be done. Constructor property promotion works by removing the declaration of …

PHP – Constructor Property Promotion Read More »

PHP – The Elvis Operator (?:) Explained

In PHP, the question mark immediately followed by a colon like this ?: is unofficially referred to as the elvis operator. The elvis operator is a variation of the ternary operator that can seem cryptic initially while reading code. However, once it is understood it is a helpful way to quickly write code that reduces …

PHP – The Elvis Operator (?:) Explained Read More »

macOS – Fix Period Automatically Added After Two Spaces

Recently while using macOS I began having an irritating issue. While typing, a period would automatically be added to a line of text. This happened on various applications like MYSQL Workbench, Microsoft Word, Google Chrome, and Mozilla Firefox. This irritating issue happens when the “Add period with double-space” setting is turned on in macOS. As …

macOS – Fix Period Automatically Added After Two Spaces Read More »

Google Chrome – How To Auto Open DevTools For Popup Windows

Sometimes when debugging in web development it helps to have the Google Chrome’s DevTools open as soon as a new window or tab is opened. This can be to view Network panel or Console log. Google Chrome’s Devtools has a setting that can always open the DevTools for popup windows. To turn on this setting …

Google Chrome – How To Auto Open DevTools For Popup Windows Read More »

Laravel – How To Check If A Collection Is Empty

In Laravel, it is a common mistake to use PHP’s empty() function to check if a collection is empty. When empty() is used on an empty array [] the boolean value of true is returned. However, using empty() on a collection can cause unexpected results because when a collection has no values the empty() function …

Laravel – How To Check If A Collection Is Empty Read More »

PHP – Loose Comparison (==) VS Strict Comparision (===)

In PHP, there are two options when comparing values in a condition. These comparison options are loose comparison (==) and strict comparison (===). PHP is a loosely typed language which means that variables can be assigned different data types during execution of the application and different data types can be compared in a conditional. This …

PHP – Loose Comparison (==) VS Strict Comparision (===) Read More »