php - Suppress errors when using global function

I'm using the NinjaForms plugin which defines a Ninja_Forms() global function.Although I can call it without proble

I'm using the NinjaForms plugin which defines a Ninja_Forms() global function.

Although I can call it without problem, I still get a warning/error

Undefined function 'Ninja_Forms'.

If this were a variable I'd use global foo to suppress that.

How do I do that for a global function - i.e. is there a global equivalent for functions?

I'm using the NinjaForms plugin which defines a Ninja_Forms() global function.

Although I can call it without problem, I still get a warning/error

Undefined function 'Ninja_Forms'.

If this were a variable I'd use global foo to suppress that.

How do I do that for a global function - i.e. is there a global equivalent for functions?

Share Improve this question edited Jan 27, 2020 at 7:04 lonix asked Jan 26, 2020 at 9:18 lonixlonix 3011 silver badge10 bronze badges 6
  • Global isn’t a magic way to suppress errors. You have a problem with your code that actually needs to be fixed. Where and how are you using the function? – Jacob Peattie Commented Jan 26, 2020 at 10:12
  • I'm using the function as advertised by its author. I want to know what is the "global" equivalent for functions, if at all. The downvote was unnecessary. – lonix Commented Jan 26, 2020 at 10:54
  • There isn’t one. The premise of your question is incorrect, which is why I’m saying that something else is wrong. And you didn’t answer my question: Where and how are you using the function? – Jacob Peattie Commented Jan 26, 2020 at 13:54
  • That is irrelevant to my question - which was whether there is a global equivalent for functions? If not, then that's the answer. I don't like globals, but sometimes it's necessary/convenient. NinjaForms is a very popular plugin, so I'm not doing anything wrong. Thanks for your help. – lonix Commented Jan 27, 2020 at 6:52
  • You are doing something wrong. If you weren’t there’d be no error. But you’re clearly not actually interested in figuring out what it is, having invented your own solution and refused to provide any information that could be used to help. For your own sake I hope that you’re less needlessly stubborn the next time you ask for help. – Jacob Peattie Commented Jan 27, 2020 at 6:58
 |  Show 1 more comment

1 Answer 1

Reset to default -1

According to comments above, there is no "global" equivalent for functions. So I'm just gonna live with the warning, since everything works.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744802380a4594570.html

相关推荐

  • php - Suppress errors when using global function

    I'm using the NinjaForms plugin which defines a Ninja_Forms() global function.Although I can call it without proble

    2天前
    50

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信