There are various ways of validating dates in PHP or MySql, sometimes however you may just need to check if a given string is a valid MySql date string, outside of a form validator. One way to achieve this is to use a regular expression, the simple utility function below will accept a string and return true if it’s a valid MySql date.

Snippet

A useful function to generate a random string of a given length in php. The character source set is predefined, but can also be explicitly set. Can have multiple use cases, for example a unique identifier in an application or a handy utility for say a random password generator.

Snippet

I came across a familiar issue last week when fixing some css bugs for a particular project, where SVG background images appeared to be squished in IE. The problem occurred wherever I had used an SVG as a css background image and scaled it with the background-size…

Article

There are various ways of retrieving a Magento category attribute, however depending on how it’s stored in the database you can’t always rely on the same method each time. This snippet will show you how to get the value of any Magento category attribute.

Snippet