MySQL INET_ATON and INET_NTOA

You can convert an IP address to an int, and vice versa, with these two MySQL functions. Of course I learned about this after I’d already implemented IP address support using BINARY(4) and my own parser/formatter… now that I have my own implementation I can’t bring myself to let it go, and I worry about support for signed/unsigned 32-bit ints (perhaps my concerns are unfounded..?)

PHP Traits and Grafts

Reading about traits and grafts in PHP: Request for Comments: Horizontal Reuse for PHP, PHP Traits, Using Traits in PHP 5.4 and PHP Traits: Good or Bad?. They mentioned the Diamond Problem.

I learned some new syntax too! E.g.:

 return $_instance ?: $_instance = new $class;

The ternary operator as a ‘binary’ operator! Cool! See here for details: Since PHP 5.3, it is possible to leave out the middle part of the ternary operator.