PHP supports assertions that trigger an error when a condition is not met. Mostly, assertions are used for testing or debugging purposes during development. PHP provides assert language construct that...
PHP supports magic methods that allow to perform various operations with objects. These methods names starts with two underscores (__). One of these methods is __toString magic method which allows...
PHP is a programming language that commonly used to create web applications and dynamic websites. With each release of PHP, new features and various changes are introduced.
This tutorial shows...
JSON is a text-based data format that commonly used to store or transmit data objects between systems. JSON is widely used in web applications. In versions prior to PHP 8.0...
In versions prior to PHP 8.0, the throw keyword is a statement. It means that throw cannot be used in places where only a single expression is expected.
Since PHP...
In versions prior to PHP 8.0, we can specify a single type for parameters, return values, and properties.
Since PHP 8.0, we can use union types. A union type allows...
PHP supports positional arguments. It means that we need to pass these arguments to a function or method based on the parameter position. The order of these arguments are important...
A non-static method is a method that belongs to an instance of a class. In all PHP 7 versions, calling non-static methods statically is deprecated and emits a warning (E_DEPRECATED...
PHP allows using a trailing comma for the last item in the array. It's for convenience because we can add another element to the array without modifying the last line...
In versions prior to PHP 8.0, the precedence of concatenation (.), + and - operators are equal, and these operators are evaluated from left to right.
Consider the following line...