Chapter 2. Deprecated Features
Over the last few releases of PHP 5.x, we’ve seen a number of features marked as deprecated, and with PHP 7.0, they have all been removed.
Deprecated
A feature is marked as deprecated to warn developers that it will be removed in an unspecified future version of the language so that they can start to migrate away from using the feature or avoid using it in the first place. In PHP, using these features will cause an E_DEPRECATED
error to be emitted.
Alternative PHP Tags
While some developers may not even be aware of it, PHP has alternative open and close tags, both of which have been removed.
These were known as script tags, as shown in Example 2-1, and ASP tags—which included a short echo tag—as shown in Example 2-2.
While I expect that the number of people using these tags is minimal, I have seen the ASP syntax used for templates. If you are using them, you will need to change to using the standard PHP tags, <?php
, <?=
, and ?>
.
POSIX-Compatible Regular Expressions
Deprecated in PHP 5.3, POSIX-compatible regular expressions, used for string pattern matching, have been removed in PHP 7.0. This means that the entire ext/ereg extension has been removed.
This includes the following functions:
-
ereg()
-
eregi()
-
ereg_replace()
-
eregi_replace()
-
split()
-
spliti()
-
sql_regcase()
Migrating to Perl Compatible ...
Get Upgrading to PHP 7 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.