Changes to the PHP 5 OOP model are logged here. Descriptions and other notes regarding these features are documented within the OOP 5 documentation.
|7.0.0||Defining (compatible) properties in two used traits no longer triggers an error.|
|5.6.0||Added: The __debugInfo() method.|
|5.5.0||Added: The ::class magic constant.|
|5.5.0||Added: finally to handle exceptions.|
|5.4.0||Changed: If an abstract class defines a signature for the constructor it will now be enforced.|
|5.3.3||Changed: Methods with the same name as the last element of a namespaced class name will no longer be treated as constructor. This change doesn't affect non-namespaced classes.|
|5.3.0||Changed: Classes that implement interfaces with methods that have default values in the prototype are no longer required to match the interface's default value.|
|5.3.0||Changed: It's now possible to reference the class using a variable (e.g., echo $classname::constant;). The variable's value can not be a keyword (e.g., self, parent or static).|
|5.3.0||Changed: Prior to 5.3.0, exceptions thrown in the __autoload() function could not be caught in the catch block, and would result in a fatal error. Exceptions now thrown in the __autoload function can be caught in the catch block, with one provison. If throwing a custom exception, then the custom exception class must be available. The __autoload function may be used recursively to autoload the custom exception class.|
|5.3.0||Added: The __callStatic method.|
|5.3.0||Added: heredoc and nowdoc support for class const and property definitions. Note: heredoc values must follow the same rules as double-quoted strings, (e.g., no variables within).|
|5.3.0||Added: Late Static Bindings.|
|5.3.0||Added: The __invoke() method.|
Changed: The __toString() method was only called when it was directly combined with echo or print. But now, it is called in any string context (e.g. in printf() with %s modifier) but not in other types contexts (e.g. with %d modifier). Since PHP 5.2.0, converting objects without a __toString method to string emits a
Changed: In previous versions of PHP 5, the use of var was considered deprecated and would issue an
|5.1.0||Changed: The __set_state() static method is now called for classes exported by var_export().|
|5.1.0||Added: The __isset() and __unset() methods.|
Is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML
Variables in PHP are represented by a dollar sign followed by the name of the variable. The variable name is case-sensitive. Variable names follow the same rules as other labels in PHP. A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores.
The type of a variable is not usually set by the programmer; rather, it is decided at runtime by PHP depending on the context in which that variable is used. To forcibly convert a variable to a certain type, either cast the variable or use the settype() function on it. Note that a variable may be evaluated with different values in certain situations, depending on what type it is at the time.