Re: evaluating a variable

From: Date: Mon, 22 Dec 2003 20:32:54 +0000
Subject: Re: evaluating a variable
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-173197@lists.php.net to get a copy of this message
On Mon, 2003-12-22 at 13:09, John W. Holmes wrote: > Carey Baird wrote: > > Hey, > > > > I have stored the name of a function as a variable. I have then passed the > > variable to another function as follows: > > > > //put function name in a variable > > $contentfunction = “newsadmincontent()”; > > Take off the parenthesis... > > $contentfunction = 'newsadmincontent'; > > To call the function, you simply use: > > $contentfunction(); > > Which will call the "newsadmincontent" function. > > > $contentfunction = 'newsadmincontent'; > > html_function($contentfunction); > > function html_function($func_name) > { > echo "You requested to execute the function: $func_name."; > echo 'The output of the function is: ' . $func_name(); > } Nicely explained! Please disregard my earlier suggestions. Typing too fast and not paying enough attention. I'll go sit in the corner now =) - Brad

« previous php.general (#173197) next »