final关键字只能用来定义类和定义方法。
使用final关键字标记的类不能被继承
final class person{ ....... } class student extends person{ ....... }
会出现错误提示。fatal error :class student may not inherit from final class(person)
使用final关键字标记的方法不能被子类覆盖
class person{ final function say(){ ...... } } class student extends person{ function say(){ ...... } }
会出现下面错误:
fatal error:cannot override final method person::say()
以上就是php中final关键字用法分析内容。