PHP5 refactoring

this is a refactoring for php5