Utility functions and classes for PHP