Does the order of class definition matter in PHP?

后端 未结 6 713
余生分开走
余生分开走 2020-11-30 07:21

If I have several classes in different php files that I\'m including into a single file, and some of these classes have dependencies on other classes, does the order in whic

6条回答
  •  天命终不由人
    2020-11-30 08:03

    It would matter as if one class tried to use another which had not yet been parsed, then an error would occur. The best option is to place the classes in the script so the dependancy will still be intact.

提交回复
热议问题