I want to define a function and unset it after its use just like we do with variables.
$a = \'something\';
unset($a);
echo $a; // outputs nothing
From this question:
You can use rename_function
and then redeclare the original function.
override_function may work too.
They are part of the Zend PHP Debugger, if that doesn't work then you can always try something like:
function function1(){
echo "1";
}
function function2(){
echo "2";
}
$i = "function2";
$i(); // displays 2;