It lets you choose the variable name which you use when referencing the
function, but the actual function name is set by PHP (as lambda_1, lambda_2,
etc.)

<?
$test="myFunction";
$$test = create_function('$a,$b','return log($a * $b);');
echo "myFunction is ".$myFunction(2,2)."<br>";
?> 

Kirk

> -----Original Message-----
> From: PHPBeginner.com [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 27, 2001 10:27 AM
> To: Johnson, Kirk; 'PHP General List. (E-mail)'
> Subject: RE: [PHP] Variable (naming them) Functions.
> 
> 
> create_function seems not letting you choosing it's name.
> 
> am I right, or there's a way to say: 
> create_function($name.$to.be, args,
> args, args....)?
> 
> 
> Sincerely,
> 
>  Maxim Maletsky
>  Founder, Chief Developer
> 
>  PHPBeginner.com (Where PHP Begins)
>  [EMAIL PROTECTED]
>  www.phpbeginner.com
> 
> 
> 
> 
> -----Original Message-----
> From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, April 28, 2001 1:03 AM
> To: 'PHP General List. (E-mail)'
> Subject: RE: [PHP] Variable (naming them) Functions.
> 
> 
> Did you see create_function()? Not sure if this is what you 
> are after, but
> http://www.php.net/manual/en/function.create-function.php
> 
> Kirk
> 
> > -----Original Message-----
> > From: Maxim Maletsky [mailto:[EMAIL PROTECTED]]
> > Subject: [PHP] Variable (naming them) Functions.
> >
> > Hello everyone:
> >
> > I was wondering, does anyone of you know a method to declare
> > a function
> > (give it a name) basing on a value acquired during run time?
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: 
> [EMAIL PROTECTED]
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to