[SOLVED]Passing functions as an argument.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

JellyFish wrote:In a way yes. But the create_function doesn't appear to be very..."good". Not like javascript which uses, I guess you say, closure or lambda style programming.
CAn you give an example of a "more lambda style" javascript approach?
RobertPaul
Forum Contributor
Posts: 122
Joined: Sun Sep 18, 2005 8:54 pm
Location: OCNY

Post by RobertPaul »

Yeah ... you want closures. PHP doesn't have closures. It's been emulated ... but it all seems a bit hackish.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I've pretty much always felt that if you need closures (in the sense desired) you have a code smell. The smell is equal to that of using eval() in my book.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Only if imperative languages treat functions as second class citizens.
Post Reply