Skip to content

Instantly share code, notes, and snippets.

@mnapoli
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mnapoli/452b2a9e8ab6dd8535cf to your computer and use it in GitHub Desktop.
Save mnapoli/452b2a9e8ab6dd8535cf to your computer and use it in GitHub Desktop.
<?php
$factory = function () {
return new Foo();
}
$factory = function () use ($factory) {
$object = $factory();
$object->setOption('Hello');
return $object;
}
$object = $factory();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment