Validation utility for PHP5