There is a lot of books and tutorials about php that are completely different from each other.
How can I choose the right way? Is the only way is test with xdebug or phpUnit or benchmark?
There is a lot of books and tutorials about php that are completely different from each other.
How can I choose the right way? Is the only way is test with xdebug or phpUnit or benchmark?
As code quality/readability/maintainability cannot be "benchmarked", I suggest reading books about proper code structuring and best practices.
Maybe Code Complete book from Steve McConnell?
It's also worth mentioning the use of a well defined pattern like MVC and build your project with some Framework like Zend, as this will encourage you to put each piece of code where it belongs.
xdebug is a very powerful tool and can help you a lot.
You will be able to see in your development server (and not an ideal server) what is happening with your code!
Download a well known open source project or framework like Zend. Then read through some of the code to see how they approach common tasks, and the general structure they use.
Have a look at the slides and the tools given at
Disclaimer: I am not affiliated with Sebastian Bergmann or thePHP.cc - they just happen to be major influence on the code quality topic in the PHP world, which is why I suggest this link.
If you like to improve your php code here are several advices:
Regards