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