Re: Re: Closures and __FUNCTION__

From: Date: Mon, 13 Apr 2009 08:03:52 +0000
Subject: Re: Re: Closures and __FUNCTION__
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-43669@lists.php.net to get a copy of this message
Quoth Justin Martin on Pungenday, the 30th of Discord: > If I recall correctly, you can use the 'use' keyword. Thanks, Justin; that occurred to me, too. But the following results in "Notice: Undefined variable: factorial": $factorial = function($n) use ($factorial) { if ($n == 1) return 1; else return $n * $factorial($n - 1); }; print $factorial(3); and eventually "PHP Fatal error: Function name must be a string."

« previous php.internals (#43669) next »