PHP 5.3 新特性

  • Namespaces (documentation maybe out dated)

    这就是传说中的“命名空间”啦,注意他与其他语言的区别

  • Lambda functions and closures

    支持λ函数和闭包运算

  • Addition of the intl, phar (phar is scheduled for some more work a head of alpha2), fileinfo and sqlite3 extensions

    支持intl、phar、fileinfo和sqlite3等扩展

  • Optional cyclic garbage collection

    可选的循环垃圾收集器

  • Optional support for the MySQLnd replacement driver for libmysql

    可选的替代libmysql的MySQLnd支持

  • Windows older than Windows 2000 (Windows 98, NT4, etc.) are not supported anymore (details)

    不再支持Win2000以前的系统(Windows 98, NT4等等)

  • New syntax features like NOWDOC, limited GOTO, ternary short cut "?:"

    支持新的语法特性如“NOWDOC”等,限制了“GOTO”和三元运算符“?:”等

    在我看来,此次版本步进,最大的意义在于上边的“命名空间”、“晚(静态)绑定”和MySQLnd,“命名空间”的呼声很高,早就应该加进去了;“晚(静态)绑定”现在还没看到实际东西,暂不做评论;至于MySQLnd,这个是MySQL官方出品的“Native driver for PHP”,针对这句话,官方是这么解释的

  • “native”: This doesn’t mean “written in PHP”; that would be too slow. PHP itself is a program written in C. Therefore “native” means this driver is written in C and tightly integrated into PHP at the C level. This allows the driver to achieve maximum performance (just like libmysql).

    这意味着不是“以PHP编写”,因为那样速度很慢。PHP本身是用C语言编写的,因此“native”意味着这个数据库驱动也是以C语言编写并在C语言级别上与PHP紧密集成。这使得驱动能够发挥最大的效能(类似libmysql)。

  • “driver”: This is not a new programming API or PHP extension; there are already three APIs (ext/mysql, ext/mysqli, PDO/MySQL) and three extensions, so there is no need for more. Rather, mysqlnd is a library that implements the MySQL low-level communication protocol. This library can be used by the existing extensions. Currently ext/mysql and ext/mysqli have been modified so they can optionally use mysqlnd instead of libmysql, and PDO/MySQL will be modified later.

    这不是一个新的API或PHP扩展,已经有三套API(ext/mysql、ext/mysqli、PDO/MySQL)和三套扩展所以不必开发更多的。而MySQLnd更像是一个实现了与MySQL底层通讯协议的库,可以被已经存在的扩展使用。现在ext/mysql和ext/mysqli已经过修改可以选择使用MySQLnd来代替libmysql,PDO/MySQL随后也将做修改。

  • “for PHP”: This is nothing new in the sense that libmysql is also for PHP. But mysqlnd is published under the terms of the PHP license whereas libmysql was not. Therefore, unlike with libmysql, there is no need for the FLOSS License Exception to make the license compatible with that of PHP. Those who recall the (partly heated) discussions about the exception might be especially happy to hear about this.

    与libmysql for PHP而言,这没什么变化,但MySQLnd基于PHP License发布而libmysql不是。因此,不再需要FLOSS License以使其兼容,对于提出这项内容的人而言是一个好消息。

  • 留下评论

    邮箱地址不会被公开。 必填项已用*标注

    此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据