PHP5.3--PHP7 新特性总结
PHP5.3
①Added "?:" operator (?添加了?:操作符)
指的是三元運算符可以簡寫:
$x = true;
$rs = $x?:false;//$x?$x:false;
②Added lambda functions and closures
(增加了匿名函數和閉包)
③Added support for namespaces
(增加了命名空間的支持)
?
PHP5.4
①Added short array syntax support (添加了短數組語法的支持。)
數組可以像js那樣寫了[1,2,3]
②Added array dereferencing support.(添加了數組的延遲支持)
數組立即調用
③Added class member access on instantiation support
(對象也可以立即調用 ?e.g. (new foo)->bar() )
④<?= is now always available regardless of the short_open_tag_setting
(短標簽的支持<h1><?=$title?></h1>)
⑤Added binary numbers format (0b001010)
增加二進制表示
⑥Added support for Traits
?
PHP5.5...未完待續...
轉載于:https://www.cnblogs.com/ityang666/p/php.html
總結
以上是生活随笔為你收集整理的PHP5.3--PHP7 新特性总结的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CCNA training notes
- 下一篇: phpstorm xdebug配置