PHP升級日誌

來源:互聯網
上載者:User

標籤:function   關鍵字   運算式   

PHP 5.6
    ... 運算子定義變長參數函數
    ... 運算子進行參數展開
    ** 進行冪運算
    use function 以及 use const
    __debugInfo()

PHP 5.5.0
    新增 Generators
    新增 finally 關鍵字
    foreach 現在支援 list()
    empty() 支援任意運算式
    array and string literal dereferencing , 例: echo [1, 2, 3][0];

PHP 5.4.0
    新增支援 traits 。
    新增短數組文法,比如 $a = [1, 2, 3, 4]; 或 $a = [‘one‘ => 1, ‘two‘ => 2, ‘three‘ => 3, ‘four‘ => 4]; 。
    新增支援對函數返回數組的成員訪問解析,例如 foo()[0] 。
    現在 閉包 支援 $this 。
    現在不管是否設定 short_open_tag php.ini 選項,<?= 將總是可用。
    新增在執行個體化時訪問類成員,例如: (new Foo)->bar() 。
    現在支援 Class::{expr}() 文法。

PHP 5.3.0
    添加了命名空間的支援.

    添加了靜態晚綁定支援.
    添加了跳標籤支援.
    添加了原生的閉包(Lambda/匿名函數)支援.
    新增了兩個魔術方法, __callStatic 和 __invoke.
    添加了 Nowdoc 文法支援, 類似於 Heredoc 文法, 但是包含單引號.
    使用 Heredoc 來初始化靜態變數和類屬性/常量變為可能.
    可使用雙引號聲明 Heredoc, 補充了 Nowdoc 文法.
    可在類外部使用 const 關鍵詞聲明 常量.   


PHP升級日誌

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.