Home > php教程 > php手册 > PHP延迟静态绑定示例分享

PHP延迟静态绑定示例分享

WBOY
Release: 2016-06-06 20:21:07
Original
1519 people have browsed it

在PHP5.3中,给类加入了关键词static,用于实现延迟静态绑定(late static binding),那么我们来看看一个示例来好好学习下

没怎么用过这个新特性,其实也不算新啦,试试吧,现在静态类的继承很方便了

'; echo C::test(); echo '
'; echo B::test2(); echo '
'; echo C::test2(); echo '
'; echo A::test(); echo '
'; echo A::test2(); echo '
';

// 输出结果 B C 456789 abcdef A 123456

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template