Friday, July 13, 2012

What PHP 5.5 might look like - Nikita Popov

What PHP 5.5 might look like - Nikita Popov:
PHP 5.4 was released just four months ago, so it probably is a bit too early to look at the next PHP version. Still I’d like to give all the people who aren’t following the internals mailing list a small sneak peak at what PHP 5.5 might look like.

But be sure to understand this: PHP 5.5 is in an early development stage, so nobody knows how the end result will look like. All I am talking about here are proposals. I’m pretty sure that not all of the things listed below will go into PHP 5.5, or at least not in their current form.

So, don’t get too excited about this :)

The list of new features / proposals is rather large and not sorted by significance. So if you don’t want to read through all of it, here are the four features I personally am most excited about:


Now, without further ado, the list of stuff being worked on for PHP 5.5:


Backwards compatibility breaks



We’ll start off with two changes that already landed in master and represent BC breaks (to some degree at least):


Windows XP and 2003 support dropped


Status: landed; Responsible: Pierre Joye
PHP 5.5 will no longer support Windows XP and 2003. Those systems are around a decade old, so PHP is pulling the plug on them.


/e modifier deprecated


Status: landed; Responsible: myself
The e modifier instructs the preg_replace function to evaluate the replacement string as PHP code instead of just doing a simple string replacement. Unsurprisingly this behavior is a constant source of problems and security issues. That’s why use of this modifier will throw a deprecation warning as of PHP 5.5. As a replacement you should use the preg_replace_callback function. You can find more information on this change in the corresponding RFC.


Function and class additions



Next we’ll look at some the planned function and class additions:


boolval()


Status: landed; Responsible: Jille Timmermans
PHP already implements the strval, intval and floatval functions. To be consistent the boolval function is now added, too. It does exactly the same thing as a (bool) cast, but can be used as a callback function.


hash_pbkdf2()


Status: landed; Responsible: Anthony Ferrara
PBKDF2 stands for “Password-Based Key Derivation Function 2” and is - as the name already says - an algorithm for deriving a cryptographic key from a password. This is required for encryption algorithms, but can also be used for password hashing. For a more extensive description and usage examples see the RFC.


Intl additions


Status: landed; Responsible: Gustavo André dos Santos Lopes
There have been many improvements to the intl extension. E.g. there will be new IntlCalendar, IntlGregorianCalendar, IntlTimeZone, IntlBreakIterator, IntlRuleBasedBreakIterator, IntlCodePointBreakIterator classes. I sadly don’t know much about the intl extension, so I will just direct you to the mailing list announcements for Calendar and BreakIterator, if you want to know more.


array_column()


Status: proposed; Responsible: Ben Ramsey
There is a proposal pending for a new array_column (or array_pluck) function that would behave as follows:

<?php

$userNames = array_column($users, 'name');
// is the same as
$user


Truncated by Planet PHP, read more at the original (another 15293 bytes)

DIGITAL JUICE

No comments:

Post a Comment

Thank's!