php6 features


php6 features

 

New Features in PHP 6.0 (and a few things about 5.3) Bryan Alsdorf bryan@mysql.com 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 ? 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 Questions? Links for more info

PARTAGER SUR

Envoyer le lien par email
1318
READS
0
DOWN
7
FOLLOW
2
EMBED
DOCUMENT # TAGS
#php  #php6  #cache php  #APC  #Mysql driver 

Licence Publique Générale GNU


DOCUMENT # INDEX
PHP 
img

Partagé par  mistigri

 Suivre

Auteur:Bryan Alsdorf
Source:mysql