Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering PHP 7

You're reading from   Mastering PHP 7 Design, configure, build, and test professional web applications

Arrow left icon
Product type Paperback
Published in Jun 2017
Publisher Packt
ISBN-13 9781785882814
Length 536 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Branko Ajzele Branko Ajzele
Author Profile Icon Branko Ajzele
Branko Ajzele
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. The All New PHP FREE CHAPTER 2. Embracing Standards 3. Error Handling and Logging 4. Magic Behind Magic Methods 5. The Realm of CLI 6. Prominent OOP Features 7. Optimizing for High Performance 8. Going Serverless 9. Reactive Programming 10. Common Design Patterns 11. Building Services 12. Working with Databases 13. Resolving Dependencies 14. Working with Packages 15. Testing the Important Bits 16. Debugging, Tracing, and Profiling 17. Hosting, Provisioning, and Deployment

The All New PHP

Programming languages nowadays are a dime a dozen. New languages spring into existence every so often. Choosing the right one for the job is so much more than just a checklist of its features. Some of them target specific problem domains, others try to position themselves for more general use. This goes to say that software development is a dynamic ecosystem where languages need to constantly adapt to ever-changing industry in order to stay relevant to its consumers. These changes are particularly challenging for already established languages such as PHP, where backward compatibility is an important consideration.

Originally created by Rasmus Lerdorf around 1995, PHP started its life as nothing more than a few Common Gateway Interface (CGI) programs in C. At that time, it was a simple scripting solution that empowered developers to build dynamic HTML pages with ease. Without the need to compile, developers could easily throw in a few lines of code into a file and see the results in the browser. This gave a rise to its early popularity. Two decades later, PHP matured into a rich general-purpose scripting language suited to web development. Throughout all these years, PHP managed to yield an impressive set of features with each new release whilst maintaining a trustworthy level of backward compatibility. Nowadays, large number of its core extensions ultimately simplify working with files, sessions, cookies, databases, web services, cryptography, and many other features common to web development. Its outstanding support for the object-oriented programming (OOP) paradigm made it truly competitive with other leading industry languages.

The decade-old ruling of PHP 5 has been overthrown by the release of PHP 7 in December 2015. It brought forth the all new execution engine, Zend Engine 3.0, which significantly improved performance and reduced memory consumption. This simple software update now allowed us to serve more concurrent users without adding any physical hardware to the mix. Acceptance among developers has been almost instant, all the more so because backward incompatibility was minimal, making migration as painless as possible.

In this chapter, we will take a detailed look into some of the new features introduced in PHP 7 and 7.1 releases:

  • Scalar type hints
  • Return type hints
  • Anonymous classes
  • Generator delegation
  • Generator return expressions
  • The null coalesce operator
  • The spaceship operator
  • Constant arrays
  • Uniform variable syntax
  • Throwables
  • Group use declarations
  • Class constant visibility modifiers
  • Catching multiple exceptions types
  • Iterable pseudo-type
  • Nullable types
  • Void return types

It is features like these that are bound to make a mark on the next generation of PHP frameworks and libraries, as well as how we write our own code.

You have been reading a chapter from
Mastering PHP 7
Published in: Jun 2017
Publisher: Packt
ISBN-13: 9781785882814
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime