Added comments / tidied code where appropriate
Merge pull request #1556 from benjamij/php-update-190614

Added comments / tidied code where appropriate