On Wed, 29 May 2002, Laurent Drouet wrote:
> I would like to know if there is a way to unset a function or to replace
> function contents by an other ?

Not natively, that I know of.

If you think you'll have to do a lot of that, it's probably easier to keep 
the function name in a variable, and just change that when you want the 
function called to change.

<?

  function add($a, $b) { return $a + $b; }
  function subtract($a, $b) { return $a - $b; }

  $mathfunc = 'add';
  print '<br>' . $mathfunc(5, 3);

  // now we want to replace mathfunc so it subtracts instead of adds:
  $mathfunc = 'subtract';
  print '<br>' . $mathfunc(5, 3);

?>

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to