Skip to content

Instantly share code, notes, and snippets.

@AV4TAr
Last active December 18, 2015 05:18
Show Gist options
  • Select an option

  • Save AV4TAr/5731236 to your computer and use it in GitHub Desktop.

Select an option

Save AV4TAr/5731236 to your computer and use it in GitHub Desktop.
<?php
Class Pepe
{
protected $loaded;
public function __construct()
{
$that = $this;
$this->loaded = function () use ($that) {
$that->load();
};
}
public function haceAlgo(){
$this->loaded && $this->loaded->__invoke();
}
public function load()
{
//...
}
}
@AV4TAr
Copy link
Author

AV4TAr commented Jun 7, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment