simplify php code