Edd Mann Developer

Validating 32-bit Integers using PHP

Last week I was required to validate that a supplied integer would fit correctly into a 32-bit address space. The available size of an integer within PHP is platform dependent, and could either be 32 or 64 bits based on the architecture you are using. This function had to cater for these differences and as such I decided to explore a couple of different options for producing this validation.

Operations on a Deck of Cards in PostgreSQL

Recently I have been looking more into SQL and in-particular how RDMS’s work under-the-hood. I thought it would be interesting to use some of the lesser-known features that PostgreSQL has to offer, concentrating my efforts on operations performed on a deck of cards.

Using the 'IS (NOT) DISTINCT FROM' SQL comparators

In a recent SQL statement I stumbled upon an issue in-regard to handling NULL values within a given predicate. Coming from languages (such as PHP) which are very liberal in their type coercion (NULL can be treated as a falsey value), I was surprised to find how the inclusion of such a value resulted in a sort of predicate short-circuiting.