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 »

SQL – How To Write Queries For NULL Values – IS NULL And IS NOT NULL

In SQL, when writing queries to check if column values are NULL it is common to attempt WHERE conditions using ‘column_name = NULL’ or ‘column_name != NULL’ or ‘column_name <> NULL‘. Trying to check if a column is NULL using equal or not equal will actually provide incorrect results. This article will cover how to …

SQL – How To Write Queries For NULL Values – IS NULL And IS NOT NULL Read More »

Javascript – Equality (==) Operator VS Strict Equality (===) Operator

In Javascript, there are two options when comparing values in a condition. These comparison options are equality (==) and strict equality (===). Javascript 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. In strictly …

Javascript – Equality (==) Operator VS Strict Equality (===) Operator Read More »

Javascript – When To Use console.dir() Instead Of console.log For Debugging

When debugging javascript it is common to use console.log() to print variables or messages to the browser’s dev tools console. The dir() method is another tool for logging that can be useful in certain situations. From the MDN Web Docs, console.dir() is given the following description: “The method console.dir() displays an interactive list of the properties of …

Javascript – When To Use console.dir() Instead Of console.log For Debugging Read More »