PHP 5.3/6 新增功能 – Late Static Bindings PHP5.3/6.0 新增延後靜態繫結(late static bindings)功能

石頭閒語:PHP 5.3/6 新增功能 – Late Static Bindings – 樂多日誌

PHP 5.3/6 新增功能 – Late Static Bindings

PHP5.3/6.0 新增延後靜態繫結(late static bindings)功能。 此功能由關鍵字 static 實現,係對照 self 之功能而出現。

self 關鍵字採用儘早靜態繫結策略,PHP 在解譯語法時,就直接將 self 繫結到它所在的類別。static 關鍵字採用延後靜態繫結(late static bindings)策略,要等到執行到那一段敘述時, PHP 才會根據調用者所屬類別來設定 static 所代表的類別。

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *

What is 7 + 3 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)