General functions for PHP 5.x