PHP Magic Constants

One of the cool and overlooked features of PHP is the presence of “magic constants”. These predefined constants provide helpful information about the current environment or context in which a script runs. Here are the nine magic constants currently available in PHP: These magic constants can be handy in a variety of situations. For example,…

Using Enum in PHP

An enum, or enumeration, is a data type that consists of a set of named values. In PHP, enums allow you to create a fixed set of constants representing a specific data type. The primary purpose of enums in PHP is to provide a convenient way to define a set of related constants representing a…

Beyond Compare – Compare Files and Folders

Beyond Compare is a legendary piece of software that I have been using for at least ten years. It compares files and folders with an easy-to-use interface and plenty of advanced features. I have used it to manually check code/version changes, organise photos, efficiently transfer files, and much more. For old-school web development, the FTP…

How to use PHP Type Declarations

PHP has developed into a more strictly typed language in recent years. Type Declarations help with that and are a fairly new addition to PHP, with recent releases improving them further. They give you more precise, concise code, clarity, validation, type-hinting and more. But first… what are Type Declarations? Take a look at this example:…