0% found this document useful (0 votes)
45 views

New Features in PHP 6.0 (And A Few Things About 5.3) : Bryan Alsdorf Manager of Support Systems Mysql, Inc

New features in PHP 6.0 include true support for Unicode, namespaces, late static binding, improved array syntax, microtime returning a float, and removed features like register globals and magic quotes. Namespaces allow class/function names to be prefixed, APC caching is integrated into the core, and the MySQL driver was rewritten in C for better performance.

Uploaded by

Anil Kumar Bojja
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views

New Features in PHP 6.0 (And A Few Things About 5.3) : Bryan Alsdorf Manager of Support Systems Mysql, Inc

New features in PHP 6.0 include true support for Unicode, namespaces, late static binding, improved array syntax, microtime returning a float, and removed features like register globals and magic quotes. Namespaces allow class/function names to be prefixed, APC caching is integrated into the core, and the MySQL driver was rewritten in C for better performance.

Uploaded by

Anil Kumar Bojja
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

New Features in PHP 6.

0 (and
a few things about 5.3)
Bryan Alsdorf
[email protected]
Manager of Support Systems
MySQL, Inc.
unicode!!!!

• True support for Unicode (UTF-8) in PHP 6

• Can be disabled on per server basis


caching

• APC (Alternative PHP Cache) moved to the core.

• Written by Rasmus

• Both page level (opcode) and application caching.


namespaces
• Namespaces are in PHP 6 and 5.3

• “namespace X::Y::Z” means all new class/function/


method names are prefixed with X::Y::Z class/
function/methods are resolved first against X::Y::Z.

• “import X::Y::Z as Foo” aliases the prefix “Foo” to


actually mean “X::Y::Z”
late static binding
• In both 6.0 and 5.3

• See http://blog.felho.hu/what-is-new-in-php-53-part-2-late-static-binding.html

<?php

class ActiveRecord
{
    public static function findByPk($id)
    {
        $calledClass = get_called_class();
        // The magic happens here
    }
}

class Blog extends ActiveRecord {}

Blog::findByPk(1);
?>
mysqlnd
• MySQL database driver written in the Zend Engine (nd == ‘native driver’)

• faster execution

• lower memory usage

• performance statistics

• client side cache (not ready for 5.3)

• Works with ext/mysql, ext/mysqli, PDO/mysql

• Available in 6.0 and 5.3


breaking to a label
• similar to “goto”
• Can jump to a labeled point further down
the execution path.
<?php
for ($i = 0; $i < 9; $i++)
{
if (true) {
break blah;
}
echo "not shown";
blah:
echo "iteration $i\n";
}
?>
foreach on multi-
dimensional arrays
• syntactic sugar
<?php
$a = array(
array(1, 2),
array(3, 4)
);
foreach( $a as $k => list($a, $b)) {
// blah
}
?>
improvements to []
• For both strings and arrays, the [] operator will support substr()/array_slice() functionality.

• [2,3] is elements (or characters) 2, 3, 4

• [2,] is elements (or characters) 2 to the end

• [,2] is elements (or characters) 0, 1, 2

• [,-2] is from the start until the last two elements in the array/string

• [-3,2] this is the same as substr and array_slice()

• [,] doesn't work on the left side of an equation (but does on the right side)
microtime

• microtime returns a full float instead of


“timestamp microtime”
• Just like calling microtime(true)
OO

• calling dynamic functions statically throws


E_ERROR
removed features
• register globals

• magic quotes

• safe mode

• ereg removed from the core

• long variables (i.e. $HTTP_*_VARS)

• <%
thank you
Questions?

Links for more info


• http://www.php.net/~derick/meeting-notes.html

• http://www.gravitonic.com/downloads/talks/afup-2007/php-i18n.pdf

• http://php100.wordpress.com/2007/08/17/namespaces-faq/

• http://wiki.pooteeweet.org/index.php?area=PHPTODO&page=PhP60

• http://www.tuxmachines.org/node/22115

You might also like