Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
pAUL gAO [email_address] 10-20-2011
Removed legacy features <ul><li>Safe mode and all related ini options. </li></ul><ul><li>register_globals and register_lon...
Performance & Memory Usage Improvement part 1 <ul><li>/php537/php micro_bench.php </li></ul><ul><ul><li>Max memory usage  ...
Performance & Memory Usage Improvement part 2 <ul><li>/php537/php NewObjectClassTest.php </li></ul><ul><ul><li>Running  0....
Performance & Memory Usage Improvement part 3 <ul><li>for ($count = 0; $count < 10000000; $count++) </li></ul><ul><li>{ </...
New feature: Traits <ul><li>trait Hello { </li></ul><ul><li>public function sayHello() { echo 'Hello '; } </li></ul><ul><l...
New feature: Array dereferencing <ul><li>class Foo { </li></ul><ul><li>public function bar() { } </li></ul><ul><li>} </li>...
New Feature: Indirect method call through array <ul><li>class Hello { </li></ul><ul><li>public function world($x) { </li><...
New feature: Built-in web server <ul><li>Feature for developer. </li></ul><ul><li>php -S localhost:8000 </li></ul><ul><li>...
General Improvements part 1 <ul><li>Added closure $this support back. </li></ul><ul><li>Improved unserialize() performance...
General Improvements part 2 <ul><li>Added multibyte support by default. </li></ul><ul><ul><li>Previously php had to be com...
New Functions part 1 <ul><li>MySQLnd added named pipes support. </li></ul><ul><li>Added http_response_code() function. </l...
New Functions part 2 <ul><li>Added header_register_callback() which is invoked immediately prior to the sending of headers...
Misc. Changes <ul><li>Changed $_SERVER['REQUEST_TIME'] to include microsecond precision. </li></ul><ul><li><?= is now alwa...
Timetable <ul><li>Alpha 1 - June 28 2011 (DONE) </li></ul><ul><ul><li>http://www.php.net/archive/2011.php#id2011-06-28-1 <...
Links <ul><li>Todo: </li></ul><ul><ul><li>https://wiki.php.net/todo/php54 </li></ul></ul><ul><li>SVN Repository: </li></ul...
 
Upcoming SlideShare
Loading in …5
×

Come on, PHP 5.4!

17,515 views

Published on

Introduction to PHP 5.4.

Published in: Technology
  • func()->bar(); is *not* array dereferencing

    Array dereferencing is:

    function f ()
    {
    return array( ... );
    }

    $a = f()[5];
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • I'm not sure if this is your wishlist or what is actually going to be in PHP 5.4, but the move to a default of UTF-8 is great!
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Come on, PHP 5.4!

  1. 1. pAUL gAO [email_address] 10-20-2011
  2. 2. Removed legacy features <ul><li>Safe mode and all related ini options. </li></ul><ul><li>register_globals and register_long_arrays ini options. </li></ul><ul><li>break/continue $var syntax. </li></ul><ul><li>import_request_variables(). </li></ul><ul><li>allow_call_time_pass_reference. </li></ul><ul><li>define_syslog_variables ini option and its associated function. </li></ul><ul><li>highlight.bg ini option. </li></ul><ul><li>Session bug compatibility mode (session.bug_compat42 and session.bug_compat_warn ini options). </li></ul><ul><li>session_is_registered(), session_register() and session_unregister() functions. </li></ul><ul><li>y2k_compliance ini option. </li></ul><ul><li>PDO_mysql: Removed support for linking with MySQL client libraries older than 4.1. </li></ul>
  3. 3. Performance & Memory Usage Improvement part 1 <ul><li>/php537/php micro_bench.php </li></ul><ul><ul><li>Max memory usage 1048576 bytes. </li></ul></ul><ul><ul><li>Running 27.608 s. </li></ul></ul><ul><li>/php540/php micro_bench.php </li></ul><ul><ul><li>Max memory usage 524288 bytes. </li></ul></ul><ul><ul><li>Running 13.254 s. </li></ul></ul>
  4. 4. Performance & Memory Usage Improvement part 2 <ul><li>/php537/php NewObjectClassTest.php </li></ul><ul><ul><li>Running 0.20629 s , 640616 bytes. </li></ul></ul><ul><li>/php537/php StaticClassTest.php </li></ul><ul><ul><li>Running 0.35047 s, 640616 bytes. </li></ul></ul><ul><li>/php540/php NewObjectClassTest.php </li></ul><ul><ul><li>Running 0.12018 s, 227808 bytes. </li></ul></ul><ul><li>/php540/php StaticClassTest.php </li></ul><ul><ul><li>Running 0.10803 s, 227880 bytes. </li></ul></ul>
  5. 5. Performance & Memory Usage Improvement part 3 <ul><li>for ($count = 0; $count < 10000000; $count++) </li></ul><ul><li>{ </li></ul><ul><li>$result = 100 + 100 - 100 * 100 / 100; </li></ul><ul><li>} </li></ul><ul><li>/php537/php mathTest.php </li></ul><ul><ul><li>Running 1.75259 s, 632176 bytes. </li></ul></ul><ul><li>/php540/php mathTest.php </li></ul><ul><ul><li>Running 1.06825 s, 223208 bytes. </li></ul></ul>
  6. 6. New feature: Traits <ul><li>trait Hello { </li></ul><ul><li>public function sayHello() { echo 'Hello '; } </li></ul><ul><li>} </li></ul><ul><li>trait World { </li></ul><ul><li>public function sayWorld() { echo ' World'; } </li></ul><ul><li>} </li></ul><ul><li>class MyHelloWorld { </li></ul><ul><li>use Hello, World; </li></ul><ul><li>public function sayExclamationMark() { echo '!'; } </li></ul><ul><li>} </li></ul><ul><li>$o = new MyHelloWorld(); </li></ul><ul><li>$o->sayHello(); </li></ul><ul><li>$o->sayWorld(); </li></ul><ul><li>$o->sayExclamationMark(); </li></ul>
  7. 7. New feature: Array dereferencing <ul><li>class Foo { </li></ul><ul><li>public function bar() { } </li></ul><ul><li>} </li></ul><ul><li>function func() { </li></ul><ul><li>return new Foo(); </li></ul><ul><li>} </li></ul><ul><li>func()->bar(); </li></ul>
  8. 8. New Feature: Indirect method call through array <ul><li>class Hello { </li></ul><ul><li>public function world($x) { </li></ul><ul><li>echo &quot;Hello, $xn&quot;; </li></ul><ul><li>return $this; </li></ul><ul><li>} </li></ul><ul><li>} </li></ul><ul><li>$f = array('Hello','world'); </li></ul><ul><li>var_dump($f('you')); </li></ul>
  9. 9. New feature: Built-in web server <ul><li>Feature for developer. </li></ul><ul><li>php -S localhost:8000 </li></ul><ul><li>php -S localhost:8000 -t docroot </li></ul><ul><li>php -S localhost:8000 routing.php </li></ul>
  10. 10. General Improvements part 1 <ul><li>Added closure $this support back. </li></ul><ul><li>Improved unserialize() performance. </li></ul><ul><li>Improved performance of @ (silence) operator. </li></ul><ul><li>Improved parse error messages. </li></ul><ul><li>Improved output layer. </li></ul><ul><ul><li>see README.NEW-OUTPUT-API for internals. </li></ul></ul><ul><li>Added DTrace support. </li></ul>
  11. 11. General Improvements part 2 <ul><li>Added multibyte support by default. </li></ul><ul><ul><li>Previously php had to be compiled with --enable-zend-multibyte. </li></ul></ul><ul><ul><li>Now it can be enabled or disabled through zend.multibyte directive in php.ini. </li></ul></ul><ul><li>Added optional argument to debug_backtrace() and debug_print_backtrace() to limit the amount of stack frames returned. </li></ul><ul><li>Added stream metadata API support and stream_metadata() stream class handler. </li></ul><ul><li>Added support for storing upload progress feedback in session data </li></ul>
  12. 12. New Functions part 1 <ul><li>MySQLnd added named pipes support. </li></ul><ul><li>Added http_response_code() function. </li></ul><ul><li>Added JsonSerializable interface. </li></ul><ul><li>Added FNV-1 hash support. </li></ul><ul><li>Added hex2bin() function. </li></ul><ul><li>Reflection extension: </li></ul><ul><ul><li>Added ReflectionExtension::isTemporary() and ReflectionExtension::isPersistent() methods. </li></ul></ul><ul><ul><li>Added ReflectionZendExtension class. </li></ul></ul><ul><ul><li>Added ReflectionClass::isCloneable(). </li></ul></ul>
  13. 13. New Functions part 2 <ul><li>Added header_register_callback() which is invoked immediately prior to the sending of headers and after default headers have been added. </li></ul><ul><li>SPL extension: </li></ul><ul><ul><li>Added RegexIterator::getRegex() method. </li></ul></ul><ul><ul><li>Added SplObjectStorage::getHash() hook. </li></ul></ul><ul><ul><li>Added CallbackFilterIterator and RecursiveCallbackFilterIterator. </li></ul></ul><ul><li>SNMP extension: </li></ul><ul><ul><li>OO API. </li></ul></ul>
  14. 14. Misc. Changes <ul><li>Changed $_SERVER['REQUEST_TIME'] to include microsecond precision. </li></ul><ul><li><?= is now always available regardless of the short_tags setting. </li></ul><ul><li>Changed default value of &quot;default_charset&quot; php.ini option from ISO-8859-1 to UTF-8. </li></ul>
  15. 15. Timetable <ul><li>Alpha 1 - June 28 2011 (DONE) </li></ul><ul><ul><li>http://www.php.net/archive/2011.php#id2011-06-28-1 </li></ul></ul><ul><li>Alpha 2 - July 14 2011 (DONE) </li></ul><ul><li>Alpha 3 - August 4 2011 (DONE) </li></ul><ul><li>Beta 1 - September 15 2011 (DONE) </li></ul><ul><li>Beta 2 - October 20 2011 (DONE) </li></ul><ul><li>RC 1 - November 10 2011 </li></ul><ul><li>So, maybe, Dec 2011 to <RELEASE> 5.4.0? </li></ul>
  16. 16. Links <ul><li>Todo: </li></ul><ul><ul><li>https://wiki.php.net/todo/php54 </li></ul></ul><ul><li>SVN Repository: </li></ul><ul><ul><li>http://svn.php.net/repository/php/php-src/branches/PHP_5_4 </li></ul></ul><ul><li>NEWS </li></ul><ul><ul><li>http://svn.php.net/repository/php/php-src/branches/PHP_5_4/NEWS </li></ul></ul><ul><li>Maillist: </li></ul><ul><ul><li>http://news.php.net/php.internals </li></ul></ul>

×