Fixed PHP examples

Changes here are related to the coding styles, some inconsistencies in code and unused variables.