|
Posted by Willem Bogaerts on 04/17/07 07:39
> Anyone know if PHP supports enclosures, like Javascript or Ruby? I've
> always assumed PHP lacked these. If I create a function with object
> instances, will the instances retain their state if the function
> definition is stored in a variable?
In the object oriented sense, yes. You can pass a function even if it is
a method of an instance. These functions are used in sorting, for
example (usort function). I never used pure lambda functions as I once
did in lisp, because I mainly write object-oriented code now.
See also the callback type in the documentation:
http://nl3.php.net/callback
Best regards,
--
Willem Bogaerts
Application smith
Kratz B.V.
http://www.kratz.nl/
Navigation:
[Reply to this message]
|