Adapted to PHP 5 syntax.