various php utility / helper functions