) A new function in PHP 5.3

Source: Internet
Author: User

Http://www.ibm.com/developerworks/opensource/library/os-php-5.3new1/index.html
StartArticleDescription

 

Some of them are translated as follows:
Late static bindings is a new feature added to php5.3. in pinyin, it is the expression originally fixed in the definition phase.
Or variable, which is determined only in the execution stage. For example, when a subclass inherits Static The value of an expression cannot be changed.
You do not want to see this situation
<? PHP
Class {
Public static function who (){
Echo _ class __;
}
Public static function test (){
SELF: WHO ();
}
}
Class B extends {
Public static function who (){
Echo _ class __;
}
}
B: Test (); // enter
?>
But now I want it to output B, so use late static bindings to achieve this feature.
<? PHP
Class {
Public static function who (){
Echo _ class __;
}
Public static function test (){
Static: WHO (); // late static bindings
}
}
Class B extends {
Public static function who (){
Echo _ class __;
}
}
B: Test (); // output B
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.