Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/251.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP类中“扩展”和“实现”的顺序?_Php_Oop_Inheritance_Implementation - Fatal编程技术网

PHP类中“扩展”和“实现”的顺序?

PHP类中“扩展”和“实现”的顺序?,php,oop,inheritance,implementation,Php,Oop,Inheritance,Implementation,为什么扩展和实现的顺序很重要 比如说 正确的顺序第一:扩展第二:实现 错误的顺序第一:实现第二:扩展 正确的顺序 错误的顺序 我从评论中了解到 这与核心PHP语言语法有关,因为PHP核心开发团队认为这很重要!为什么str_替换不是string_替换?这是您必须遵循的标准。它的意思是问,为什么数组的顺序或参数是搜索针/haystack而不是haystack/needle? // first:"extends" second:"implements" // works fine class Stud

为什么扩展和实现的顺序很重要

比如说 正确的顺序第一:扩展第二:实现 错误的顺序第一:实现第二:扩展

正确的顺序

错误的顺序


我从评论中了解到
这与核心PHP语言语法有关,因为PHP核心开发团队认为这很重要!为什么str_替换不是string_替换?这是您必须遵循的标准。它的意思是问,为什么数组的顺序或参数是搜索针/haystack而不是haystack/needle?
// first:"extends" second:"implements"
// works fine
class Student extends Person 
    implements Student_Interface {
    // .... 
}
// first:"implements" second:"extends"
// Give us 
// Parse error: syntax error, unexpected T_EXTENDS, expecting '{' 
class Student implements Student_Interface
     extends Person {
    // .... 
}