jueves, 14 de noviembre de 2019

The Best PHP Tricks For Beginners

The Best PHP Tricks For Beginners

PHP is the most widely used programming language on the Web. Introducing thirty-some of the best tricks for beginners who want to learn basic skills - php for beginners.

Make Friends with the PHP Reference

If you're new to PHP, then it's time to take a look at the respectful PHP reference. The PHP reference is incredibly comprehensive and contains really useful comments for each article. Before asking questions or trying to solve the problem yourself, save time and just take a course on the reference. The answers to your questions are already conveniently posted in a useful article on PHP.net.

Enable error reporting

The bug report in PHP is very useful. You will find errors in your code that you have not noticed before, but not all of them interfere with the application. There are different levels of detail of the report that you can use, but E_ALL will equally represent you all errors, critical situations and warnings.

When your application is ready for productive operation, you will have to turn off the error report, otherwise your visitors will see strange messages in which they understand nothing.

Try IDE

IDEs (Integrated Development Environments) are useful tools for any developer. Although they are not suitable for everyone, IDEs definitely have their own meaning. IDEs provide tools such as:
  • Syntax highlighting
  • Code completion (identifier hints in the code editor)
  • Error warnings
  • Code refactoring (code alteration)
As well as a large number of other features. There are many great IDEs that support PHP.

Integrated Development Environments

Try PHP Frameworks

You can learn a lot about PHP just by experimenting with PHP frameworks. Frameworks such as CakePHP or CodeIgniter allow you to quickly create PHP applications, even if you are not an expert in it. In a way, they are additional props that show you what a PHP application should look like and demonstrate useful programming concepts (such as separating logic from design, etc.).

Learn DRY

DRY is an abbreviation of Don’t Repeat Yourself, (Do Not Repeat), and it is a useful programming concept, no matter what language. DRY programming, as the name suggests, ensures that you don't write redundant code. Here is an example from Reinhold Weber:

Don’t Repeat Yourself

Use Output Buffering

Output buffering is an easy way to greatly improve the quality and speed of your PHP script. Without buffering the output, your script will display the HTML on the page as it is processed - in parts. Adding output buffering allows PHP to store HTML as a variable and send it to the browser in a single batch.

No hay comentarios.:

Publicar un comentario