Coding practices

Your code is the heart of your application; therefore, you want to write it properly, cleanly, and in an efficient manner. In this section, we will give you some hints to improve your code.

Dealing with strings

One of the standards of the industry is to use the UTF-8 format in all your application levels. If you skip this recommendation, you will be dealing with encoding problems all your project's life. At the moment of writing this book, PHP does not support Unicode at low level, so you need to be careful when dealing with strings, specially with UTF-8. The following recommendations are only if you are working with UTF-8.

In PHP, the basic string operations such as assignation or concatenation don't need anything special in UTF-8; ...

Get PHP Microservices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.