Answer by Mark Baker for Defining a function inside a conditional
You're trying to execute foo() before testing to see whether it's defined or not (and subsequently defining it)if(!function_exists("foo")) { function foo() { // do soemething } } foo();
View ArticleAnswer by NikiC for Defining a function inside a conditional
See http://www.php.net/manual/en/functions.user-defined.php:Functions need not be defined before they are referenced, except when a function is conditionally defined [...] Its definition must be...
View ArticleDefining a function inside a conditional
Snippet 1 works. Snippet 2 doesn't. Why?1.foo();function foo(){ // do soemething}2.foo();if(!function_exists("foo")){ function foo() { // do soemething }}
View Article
More Pages to Explore .....