PHP continues to be one of the most widely used scripting languages on the web, with 77.3% of all the websites whose server-side programming language is known using it, according to w3tech. PHP 8 brings many new features and improvements, which we shall explore in this article series.
PHP 8 is a major update to PHP that introduces new features and improvements in all language areas, such as expressions, classes, functions, operators, and more.
New expression-related syntax includes attributes, "match" expression, the "instanceof" operator, and the "new" operator.
Speaking of new features related to classes, PHP 8 brings:
- Enums, a layer over classes to specify an enumerated list of possible values for a type
- The new "readonly" modifier for a class property, which makes the property unmodifiable after its initialization
- Constructor parameter promotion, which is useful to assign a constructor parameter value to an object property automatically
- PHP 8.0 also adds support for several functions- and methods-related features, including enhanced callables, named function arguments, and Fibers, interruptible functions, adding support for multitasking.
Improvements to the PHP type system include union, intersection, and mixed types, as well as the "static" and "never" return types. Additionally, PHP 8 also brings support for "true", "null", and "false" stand-alone types.
Articles in this series include:
This content is an excerpt from a recent InfoQ article by Deepak Vohra, "Article Series: PHP 8.x".
To get notifications when InfoQ publishes content on these topics, follow "Programming Languages", "Development", and "Asynchronous Programming" on InfoQ.
Missed a newsletter? You can find all of the previous issues on InfoQ.
Sponsored
|
In the past twenty years, advances in distributed systems and service-oriented architecture patterns have led to an explosion of APIs. While services teams now move quickly and autonomously, their rapid production only adds to an ever-expanding sprawl of REST APIs that consuming clients must integrate and orchestrate, slowing delivery and entangling teams. This white paper outlines how technology leaders are delivering on their roadmap faster with federated GraphQL APIs that unblock their engineering teams.
Learn more in “Federated GraphQL APIs: A Faster Way to Deliver Value”, sponsored by Apollo GraphQL
|
|
Upcoming Events
QCon: For practitioners, by practitioners
Discover what's next in GenAI and Large Language Models (LLMs) at QCon London 2024 (8-10 April)
Join Hien Luu, Sr. Engineering Manager at DoorDash and author of Beginning Apache Spark 3, and a series of AI expert practitioners to explore the latest developments in LLM research and development. Learn about the different types of LLMs, their capabilities, and their limitations. Uncover the potential of LLMs to impact the future of work, education, healthcare, and many other domains. Explore this track.
Discover all 15 tracks at QCon London 2024.