miscellaneous PHP functions