Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
PHP
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== PHP 7 === During 2014 and 2015, a new major PHP version was developed, PHP 7. The numbering of this version involved some debate among internal developers.<ref>{{cite web|url=https://philsturgeon.uk/php/2014/07/23/neverending-muppet-debate-of-php-6-v-php-7/|title=The Neverending Muppet Debate of PHP 6 v PHP 7|access-date=2015-11-19|archive-url=https://web.archive.org/web/20151119132438/https://philsturgeon.uk/php/2014/07/23/neverending-muppet-debate-of-php-6-v-php-7/|archive-date=2015-11-19|url-status=dead}}</ref> While the PHP 6 Unicode experiments had never been released, several articles and book titles referenced the PHP 6 names, which might have caused confusion if a new release were to reuse the name.<ref>{{cite web |title=RFC: Name of Next Release of PHP |url=https://wiki.php.net/rfc/php6 |date=2014-07-07 |access-date=2014-07-15 |website=php.net}}</ref> After a vote, the name PHP 7 was chosen.<ref>{{cite web|title=Re: [PHP-DEV] [VOTE] [RFC] Name of Next Release of PHP (again) |url=https://www.mail-archive.com/internals@lists.php.net/msg68598.html |date=2014-07-30 |access-date=2014-07-30}}</ref> The foundation of PHP 7 is a PHP [[branching (version control)|branch]] that was originally dubbed ''PHP next generation'' (''phpng''). It was authored by Dmitry Stogov, Xinchen Hui and Nikita Popov,<ref>{{cite web|url=http://news.php.net/php.internals/73888|title=phpng: Refactored PHP Engine with Big Performance Improvement|website=news.php.net}}</ref> and aimed to optimize PHP performance by refactoring the Zend Engine while retaining near-complete language compatibility.<ref>{{cite web |url=https://wiki.php.net/rfc/phpng |title=PHP: rfc:phpng |access-date=16 December 2014 |website=php.net}}</ref> By 14 July 2014, [[WordPress]]-based benchmarks, which served as the main benchmark suite for the phpng project, showed an almost 100% increase in performance. Changes from phpng make it easier to improve performance in future versions, as more compact data structures and other changes are seen as better suited for a successful migration to a [[Just-in-time compilation|just-in-time]] (JIT) compiler.<ref name="php.net-7">{{cite web|url=https://wiki.php.net/phpng |title=PHP: phpng |website=php.net |access-date=2014-07-15}}</ref> Because of the significant changes, the reworked Zend Engine was called ''Zend Engine 3'', succeeding Zend Engine 2 used in PHP 5.<ref name="github.com-2014">{{cite web |url=https://github.com/php/php-src/commit/150dc69d6eee35738f505e925ee664c02060196d |website=github.com |date=2014-12-05 |access-date=2014-12-05 |title=Merge branch 'ZendEngine3'}}</ref> Because of the major internal changes in phpng, it must receive a new [[Software versioning|major version]] number of PHP, rather than a minor PHP 5 release, according to PHP's release process.<ref name="PHP-2011" /> Major versions of PHP are allowed to break backward-compatibility of code and therefore PHP 7 presented an opportunity for other improvements beyond phpng that require backward-compatibility breaks.{{Citation needed|date=April 2024}} In particular, it involved the following changes: * Many fatal or recoverable-level legacy PHP error mechanisms were replaced with modern object-oriented [[Exception (computer science)|exceptions]].<ref name="php.net" /> * The syntax for variable dereferencing was reworked to be internally more consistent and complete, allowing the use of the operators <code>-></code>, <code>[]</code>, <code>()</code>,<code>{}</code>, and <code>::</code>, with arbitrary meaningful left-side expressions.<ref name="php.net-2014b">{{cite web |url=https://wiki.php.net/rfc/uniform_variable_syntax |title=PHP RFC: Uniform Variable Syntax |date=2014-05-31 |access-date=2014-07-30 |website=php.net}}</ref> * Support for legacy PHP 4-style constructor methods was deprecated.<ref>{{Cite web|url=https://3v4l.org/udRhX|title=Online PHP editor | output for udRhX|website=3v4l.org}}</ref> * The behavior of the [[foreach loop|<code>foreach</code> statement]] was changed to be more predictable.<ref>{{cite web|url=https://wiki.php.net/rfc/php7_foreach|title=PHP RFC: Fix "foreach" behavior|access-date=2015-05-21|website=php.net}}</ref> * Constructors for the few classes built-in to PHP which returned null upon failure were changed to throw an exception instead, for consistency.<ref>{{cite web|url=https://wiki.php.net/rfc/internal_constructor_behaviour|title=PHP RFC: Constructor behaviour of internal classes|access-date=2015-05-21|website=php.net}}</ref> * Several unmaintained or deprecated [[server application programming interface]]s (SAPIs) and extensions were removed from the PHP core, most notably the legacy <code>mysql</code> extension.<ref>{{cite web|url=https://wiki.php.net/rfc/removal_of_dead_sapis_and_exts|title=PHP RFC: Removal of dead or not yet PHP7 ported SAPIs and extensions|access-date=2015-05-21|website=php.net}}</ref> * The behavior of the <code>list()</code> operator was changed to remove support for strings.<ref>{{cite web|url=https://wiki.php.net/rfc/fix_list_behavior_inconsistency|title=PHP RFC: Fix list() behavior inconsistency|access-date=2015-05-21|website=php.net}}</ref> * Support was removed for legacy ASP-style delimiters <code><%</code> and <code>%></code> and <code><script language="php"> ... </script></code>.<ref>{{cite web|url=https://wiki.php.net/rfc/remove_alternative_php_tags|title=PHP RFC: Remove alternative PHP tags|access-date=2015-05-21|website=php.net}}</ref> * An oversight allowing a [[switch statement]] to have multiple <code>default</code> clauses was fixed.<ref>{{cite web|url=https://wiki.php.net/rfc/switch.default.multiple|title=PHP RFC: Make defining multiple default cases in a switch a syntax error|access-date=2015-05-21|website=php.net}}</ref> * Support for hexadecimal number support in some implicit conversions from strings to number types was removed.<ref>{{cite web|url=https://wiki.php.net/rfc/remove_hex_support_in_numeric_strings|title=PHP RFC: Remove hex support in numeric strings|access-date=2015-05-21|website=php.net}}</ref> * The [[left-shift operator|left-shift]] and [[right-shift operator|right-shift]] operators were changed to behave more consistently across platforms.<ref name="php.net-5" /> * Conversions between floating-point numbers and integers were changed (e.g. infinity changed to convert to zero) and implemented more consistently across platforms.<ref name="php.net-5">{{cite web|url=https://wiki.php.net/rfc/integer_semantics|title=PHP RFC: Integer Semantics|access-date=2015-05-21|quote=Making NaN and Infinity always become zero when cast to integer means more cross-platform consistency, and is also less surprising than what is currently produces|website=php.net}}</ref><ref>{{cite web|url=https://wiki.php.net/rfc/zpp_fail_on_overflow|title=PHP RFC: ZPP Failure on Overflow|access-date=2015-05-21|website=php.net}}</ref> PHP 7 also included new language features. Most notably, it introduced return type declarations for functions<ref name="php.net-2015a">{{cite web |url=https://wiki.php.net/rfc/return_types |title=RFC: Return Types |date=2015-01-27 |access-date=2015-01-28 |website=php.net}}</ref> which complement the existing parameter type declarations, and support for the [[Variable (computer science)|scalar]] types (integer, float, string, and boolean) in parameter and return type declarations.<ref name="php.net-2015b">{{cite web|url=https://wiki.php.net/rfc/scalar_type_hints_v5|title=RFC: Scalar Type Declarations |date=2015-03-16 |access-date=2015-03-17 |website=php.net}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)