- 15, Jun 2020
- #1
Errors in programs are inevitable. The larger the project, the more difficult it is to identify and correct errors in it.
Also a very important aspect in working with the program is the qualification of the programmer and his desire to write accurate, correct code, in which there will be a minimum of errors.
In this article I will try to describe special techniques and techniques that will minimize the number of errors in programs written in PHP.
Some of these methods can be useful not only for programs in PHP, but also programs written in other programming languages.
Knowledge is 50% success. In all programming languages, there are many dangerous situations that can cause errors.
If the source code of the program is disassembled by the translator, it can inform developers about such situations.
To do this, you just need to enable the corresponding option, which by default is disabled in most cases for certain reasons.
In PHP, the error_reporting function and the directive of this function in php.ini control the output of translator messages.
It is recommended to set the value to E_ALL - i.e. Messages will be displayed when any potentially dangerous situation occurs.
Such in PHP include, for example, accessing an element from an array that does not exist or using an uninitialized variable, etc.
To enable the most detailed output of translator messages, you must put the error_reporting function call at the beginning of the program code: // For PHP4error_reporting (E_ALL); Or set this value in php.ini (error_reporting = E_ALL).
Also a very important aspect in working with the program is the qualification of the programmer and his desire to write accurate, correct code, in which there will be a minimum of errors.
In this article I will try to describe special techniques and techniques that will minimize the number of errors in programs written in PHP.
Some of these methods can be useful not only for programs in PHP, but also programs written in other programming languages.
Knowledge is 50% success. In all programming languages, there are many dangerous situations that can cause errors.
If the source code of the program is disassembled by the translator, it can inform developers about such situations.
To do this, you just need to enable the corresponding option, which by default is disabled in most cases for certain reasons.
In PHP, the error_reporting function and the directive of this function in php.ini control the output of translator messages.
It is recommended to set the value to E_ALL - i.e. Messages will be displayed when any potentially dangerous situation occurs.
Such in PHP include, for example, accessing an element from an array that does not exist or using an uninitialized variable, etc.
To enable the most detailed output of translator messages, you must put the error_reporting function call at the beginning of the program code: // For PHP4error_reporting (E_ALL); Or set this value in php.ini (error_reporting = E_ALL).