Jump to content

Test if function delared? how?


dwest

Recommended Posts

Hi,

I've got a function that is part of a code snippet I insert into blog posts in WordPress.

 

Trouble is I may insert the snippet several times in the same post. PHP throws an error of course since the function was already declared in the previous insertion of the snippet.

 

I would add the function to the centralized functions include file in WordPress but every time I upgrade WordPress it is overwritten. I'm not likely to remember that I've got function(s) in that file that I need six months from now if I upgrade ;-)

 

So, can I wrap the function in some sort of "if this function is declared then ignore this" thing?

 

If so, what's the test for whether it has been declared?

 

Thanks!

 

Link to comment
https://forums.phpfreaks.com/topic/96830-test-if-function-delared-how/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.