PHP

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 »