Some utility functions I wrote in PHP