added in some PHP improvements that haven't been organised