Skip to content

Instantly share code, notes, and snippets.

@michaelcontento
Last active August 29, 2015 14:08
Show Gist options
  • Save michaelcontento/3e18cb1955aa1a2de99e to your computer and use it in GitHub Desktop.
Save michaelcontento/3e18cb1955aa1a2de99e to your computer and use it in GitHub Desktop.
<?php
class A
{
public function __construct()
{
$this->lambda = function() {
echo "Hello World!";
};
}
}
$a = new A();
$a->lambda();
// Fatal error: Call to undefined method A::lambda()
$a->lambda->__invoke();
// "Hello World"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment