Understanding Changes in Namespaces

Learn about named arguments and how they help developers enter data in functions and OOP.

The concept of a namespace was introduced in PHP 5.3 as a means of isolating hierarchies of classes. Unfortunately, the original algorithm that was used to parse namespace names had several flaws. In addition to being overly complicated, the way in which namespace and class names were tokenized internally was performed in an inconsistent manner, leading to unexpected errors.

Before we get into the benefits and potential backwards-compatible breaks, let’s have a look at how the namespace tokenization process has changed.

Discovering differences in tokenization

The tokenization process is an important part of the interpretation process and takes place when our PHP code is executed. In the process of producing byte code, the PHP program code is broken down into tokens by the PHP parsing engine.

The following table summarizes namespace tokenization changes:

Get hands-on with 1200+ tech skills courses.