Array elements and string offsets can be accessed using square bracket [] syntax. There is also curly brace {} syntax, which is rarely used in practice. Since PHP 7.4, curly...
Autoloading is a process to automatically load classes and interfaces without using include, include_once, require, or require_once statements at the beginning of each PHP file. The __autoload is a function...
PHP has disable_functions directive that allows to specify functions which should be disabled. This commonly used to disable unsafe functions for security reasons.
The disable_functions directive can be set in...
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:...