Array unpacking with string keysĪrray unpacking is really useful, it's been part of PHP for a while. enum Status: stringĮnums will be able to contain methods, implement interfaces and also had several built in methods that make working with them nice and easy. PHP's implementation of enums allow you to assign string or int values so that they can be serialised and/or stored in a db, this is the general use case where they're part of a domain model that's stored in the database.Ī good example of an enum is a status value that represents the current state of something like an article. Essentially an enum is a way to express a value as a type for which it will always be one of the allowed values, you've maybe used them in other languages or as a MySQL data type. EnumsĪ lot of you have probably been writing your own version of enums for a while, so it's great to have a language level option for this, it'll save a lot of boilerplate code. If you've ever used Promises in Javascript Fibers are a bit like that. This has been possible with PHP for a while but Fibers will offer a language level option for those needing it, existing async libraries will no doubt be re-written to take advantage of it. Fibersįibers are essentially threads that allow asyncronous execution of PHP code. PHP 8.1 is due to be released in November 2021, we thought we'd round up the notable new features that are being added to the language.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |