Does function definition order matter?

前端 未结 7 1786
滥情空心
滥情空心 2021-01-17 07:33

In the script below, does the order in which items are declared matter?

For example, if the add_action points to a function that has not yet been defined? Does it ma

7条回答
  •  北海茫月
    2021-01-17 08:08

    Quoting the User-defined functions section of the manual :

    Functions need not be defined before they are referenced, except when a function is conditionally defined

    So, basically : you can call a function before its definition is written -- but, of course, PHP must be able to see that definition, when try to call it.

提交回复
热议问题