PHP: Generic functions for web development