come on, php 5.4!

17
pAUL gAO [email protected] 10-20-2011

Upload: paulgao

Post on 02-Jun-2015

15.751 views

Category:

Technology


3 download

DESCRIPTION

Introduction to PHP 5.4.

TRANSCRIPT

Page 1: Come on, PHP 5.4!

pAUL [email protected]

Page 2: Come on, PHP 5.4!

Removed legacy features

Safe mode and all related ini options. register_globals and register_long_arrays ini options.

break/continue $var syntax. import_request_variables(). allow_call_time_pass_reference. define_syslog_variables ini option and its associated

function. highlight.bg ini option. Session bug compatibility mode (session.bug_compat42

and session.bug_compat_warn ini options). session_is_registered(), session_register() and

session_unregister() functions. y2k_compliance ini option. PDO_mysql: Removed support for linking with MySQL client

libraries older than 4.1.

Page 3: Come on, PHP 5.4!

Performance & Memory Usage Improvement part 1

/php537/php micro_bench.php Max memory usage 1048576 bytes. Running 27.608s.

/php540/php micro_bench.php Max memory usage 524288 bytes. Running 13.254s.

Page 4: Come on, PHP 5.4!

Performance & Memory Usage Improvement part 2

/php537/php NewObjectClassTest.php Running 0.20629s , 640616bytes.

/php537/php StaticClassTest.php Running 0.35047s, 640616bytes.

/php540/php NewObjectClassTest.php Running 0.12018s, 227808bytes.

/php540/php StaticClassTest.php Running 0.10803s, 227880bytes.

Page 5: Come on, PHP 5.4!

Performance & Memory Usage Improvement part 3

for ($count = 0; $count < 10000000; $count++)

{ $result = 100 + 100 - 100 * 100 / 100;}

/php537/php mathTest.php Running 1.75259s, 632176bytes.

/php540/php mathTest.php Running 1.06825s, 223208bytes.

Page 6: Come on, PHP 5.4!

New feature: Traits

trait Hello {

public function sayHello() { echo 'Hello '; }

}

trait World {

public function sayWorld() { echo ' World'; }

}

class MyHelloWorld {

use Hello, World;

public function sayExclamationMark() { echo '!'; }

}

$o = new MyHelloWorld();

$o->sayHello();

$o->sayWorld();

$o->sayExclamationMark();

Page 7: Come on, PHP 5.4!

New feature: Array dereferencing

class Foo { public function bar() { }}

function func() { return new Foo();}

func()->bar();

Page 8: Come on, PHP 5.4!

New Feature: Indirect method call through arrayclass Hello { public function world($x) { echo "Hello, $x\n"; return $this; }}

$f = array('Hello','world');var_dump($f('you'));

Page 9: Come on, PHP 5.4!

New feature: Built-in web server

Feature for developer.

php -S localhost:8000

php -S localhost:8000 -t docroot

php -S localhost:8000 routing.php

Page 10: Come on, PHP 5.4!

General Improvements part 1 Added closure $this support back. Improved unserialize() performance. Improved performance of @ (silence)

operator. Improved parse error messages. Improved output layer.

see README.NEW-OUTPUT-API for internals.

Added DTrace support.

Page 11: Come on, PHP 5.4!

General Improvements part 2 Added multibyte support by default.

Previously php had to be compiled with --enable-zend-multibyte.

Now it can be enabled or disabled through zend.multibyte directive in php.ini.

Added optional argument to debug_backtrace() and debug_print_backtrace() to limit the amount of stack frames returned.

Added stream metadata API support and stream_metadata() stream class handler.

Added support for storing upload progress feedback in session data

Page 12: Come on, PHP 5.4!

New Functions part 1

MySQLnd added named pipes support. Added http_response_code() function. Added JsonSerializable interface. Added FNV-1 hash support. Added hex2bin() function. Reflection extension:

Added ReflectionExtension::isTemporary() and ReflectionExtension::isPersistent() methods.

Added ReflectionZendExtension class. Added ReflectionClass::isCloneable().

Page 13: Come on, PHP 5.4!

New Functions part 2

Added header_register_callback() which is invoked immediately prior to the sending of headers and after default headers have been added.

SPL extension: Added RegexIterator::getRegex() method. Added SplObjectStorage::getHash() hook. Added CallbackFilterIterator and

RecursiveCallbackFilterIterator. SNMP extension:

OO API.

Page 14: Come on, PHP 5.4!

Misc. Changes

Changed $_SERVER['REQUEST_TIME'] to include microsecond precision.

<?= is now always available regardless of the short_tags setting.

Changed default value of "default_charset" php.ini option from ISO-8859-1 to UTF-8.

Page 15: Come on, PHP 5.4!

Timetable

Alpha 1 - June 28 2011 (DONE) http://www.php.net/archive/

2011.php#id2011-06-28-1 Alpha 2 - July 14 2011 (DONE) Alpha 3 - August 4 2011 (DONE) Beta 1 - September 15 2011 (DONE) Beta 2 - October 20 2011 (DONE) RC 1 - November 10 2011 So, maybe, Dec 2011 to <RELEASE>

5.4.0?

Page 16: Come on, PHP 5.4!

Links

Todo: https://wiki.php.net/todo/php54

SVN Repository: http://svn.php.net/repository/php/php-

src/branches/PHP_5_4 NEWS

http://svn.php.net/repository/php/php-src/branches/PHP_5_4/NEWS

Maillist: http://news.php.net/php.internals

Page 17: Come on, PHP 5.4!