The team has recently announced the list of features that are going to be released in the upcoming version of PHP. With the recent updates in the 8th version, the usage of PHP language has become increased.ĭevelopers at PHP are continuously working to improvise the features. It is one of the most used programming languages nowadays. Now there is a new set of features expected to release on 25 November 2021. fibers to simplify writing concurrent code when code is executed in an event loopįor more information on how to migrate code to PHP 8.1, you can refer to the official documentation.Īnd to actually host code with a PHP 8.1 interpreter, feel free to use our Simple Hosting service.We all know the updated features in PHP 8 that was released a few months earlier.intersection types using “&“ keyword that can be used to force a parameter to satisfy the constraints of multiple types.“new“ keyword can be used as default parameter and more generally in initializer context.“never“ return type to indicate a function should never return (and rather exit or throw an exception). a new notation for octal numbers: The “0o“ prefix can now be used (both “0o10“ and “010“ are 8, “0o1_000“ is 512).Some other changes have been introduced in PHP 8.1: “final“ is not a new keyword as it was already usable for methods and class methods. Final class constantsĬlass constants can now be made final (using the “final“ keyword) to prevent classes that inherit from them to change the constant value. They differ from constants (“const“ keyword) which are set directly when the class is defined. Readonly properties (“readonly“ keyword) allow creating objects with properties that can be set when the object is created (inside object constructor method) but cannot be changed afterwards. This has been extended to support merging arrays that have string keys: PHP already supported merging numeric-indexed arrays as in: In PHP, arrays can be used for what other languages may call lists (an ordered collection of values) or for dictionaries or hashes (a collection of (key, value) items). String-keyed array merging through unpacking “Closure::fromCallable“ and creates a shorter and clearer solution. You can now use “function_name(…)“ (where the dots are part of the syntax) to get an anonymous function as in: This can be used with “match“ expressions that were introduced in PHP 8.0:Ĭontrary to certain other languages in which functions are standard objects, in PHP you can’t just use a function reference to store it into a variable (“$var = strlen “ it not valid). Changes for developers EnumerationsĮnumerations are used whenever you need a type that provides a fixed, limited number of options and allows them to be conveniently named. It’s important to note, though, that these improvements do not depend on the use of JIT (just-in-time) compiler, so you will see improvements as soon as you start using PHP 8.1. PHP announced improvements of around 23% on page rendering using the Symphony Demo App and 3.5% for WordPress (although its latest release does not yet support PHP 8.1). Thanks to several optimizations in the PHP code, page rendering speed has been improved. Here is a summary of what we feel are the most notable aspects of this release. In its announcement addendum, php.net proudly claims the update will provide “better performance, better syntax, improved type safety.” On November 25, 2021, the PHP development team announced the immediate availability of PHP 8.1, a major release.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |