PHP coding standards
When I did write my first code, I did not know anything about PHP coding standards. My code was disgusting and very hard to read and edit. It was horror. Fortunately, that was many years ago and now have we many manuals and plugins helping us write clean and readable code.
PHP has a good community and this smart und helpful people did crate PHP standards. Since this time can we use so many great tools like "composer". This is a website then should know everyone PHP developer:
PHP Standards Recommendations
In first two chapters can you read how should look your code. That is very important to you and another programmers, who will work with your code in the future.
If you work with frameworks the standard may be different, so I recommend you check a framework documentation.
The first book "Clean code" is a bible for programmers. Many developers know this book by heart. If you did not read this book… shame on you!
Of course, you mustn’t use all advice. Sometimes should you go own way, but many Martins tips can you help write good code.
In PHP world has you two basically tools to checking your code syntax:
PHP Code Sniffer
PHP Mess Detector
In PHP Mess Detector can you set own rules like maximum number of arguments in functions or variables name length.
Both tools can you use with many IDE’s and editors, for example, VIM or PhpStorm.
At the end I recommend you see how to look popular repository on Github. You can learn many about clear code from other good developers. Good luck!