Forum Moderators: coopster
or:
2/ maybe use a static variable (or a global variable) and switch between behaviours:
function foo()
{
global $whichfoo;
switch ($whichfoo)
{
case "1" : {return true;}
case "2" : {return false;}
}
}
You can then, instead of trying to replace foo(), just change $whichfoo...
not: function foo() { return true;}
but: $whichfoo = 1;
not: function foo() { return false;}
but: $whichfoo = 2;
Reason here being you can't overwrite functions in PHP (neither 4 nor 5).
You can even just use standard function declaration notation inside an if statement -
if(!function_exists('somefunction')){
function somefunction($somevar){
/* do some stuff */
}}