PHP - defining classes inside a function

后端 未结 5 1103
清歌不尽
清歌不尽 2021-01-12 00:04

Is this a bad practice?

like:

function boo(){
  require_once(\"class.moo.php\");
}
...

?

5条回答
  •  情话喂你
    2021-01-12 00:19

    I would avoid it.

    It is not what another developer would expect, and, as such, would reduce the maintainability of your code.

提交回复
热议问题