A very handed PHP function that is easily portable and applicable, authored by Neil Masters @ codedb.co.uk.