View Single Post
Old Jan 31st, 2008, 3:31 PM   #11
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,885
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
Re: Function too convoluted?

That's pretty intense...

I only assumed it does. I thought create_function returns a reference to the anonymous function, just as a function name is a reference to a named function.

PHP Syntax (Toggle Plain Text)
  1. $newfunc = create_function('$a,$b', 'return "ln($a) + ln($b) = " . log($a * $b);');
  2. echo $newfunc(2, M_E);

Is equivilent to:
PHP Syntax (Toggle Plain Text)
  1. function newfunc ($a,$b) { return "ln($a) + ln($b) = " . log($a * $b); }
  2. echo $newfunc(2, M_E);
Sane is offline   Reply With Quote