Null is a type that has only one possible value null. The null value indicates that the variable doesn't have a value. However, due to null value, we might need...
PHP has the gettype function that allows to get the type of variable. This function can be useful for debugging, testing, creating error messages, etc.
Since PHP 8.0, we can...
The token_get_all function parses PHP source code and returns an array of tokens. Each token is represented either as a single character or an array that contains token ID, token...
PHP has the switch statement that can be used to execute different blocks of code based on different cases. Since PHP 8.0, we can use the match expression that is...
The final keyword is related to inheritance concept in object-oriented programming (OOP). Inheritance is a process when a child class inherits properties and behavior from the parent class. The final...
The final keyword can be applied to class methods. When a parent class has a method that declared as final, then child classes cannot override this method.
Private methods cannot...
The ternary (?:) operator is a conditional operator that allows to shorten if/else structures and decrease the length of code. The syntax for ternary operator can be represented as follows:...
PHP allows defining constants using define function. Defined constants are case-sensitive. For example, DB_USER and db_user represents different constants.
In versions prior to PHP 8.0, it was possible to define...
PHP has the display_startup_errors directive that specifies whether the errors must be displayed that occurred during PHP startup process. If this directive explicitly not set, default value will be used...
PHP has the error_reporting directive that specifies which type of errors to report. If error reporting level explicitly not set, default value will be used. For example, we can set...