Created
January 4, 2014 15:13
-
-
Save asm89/8256280 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class App | |
{ | |
public $callables = []; | |
public function __construct() | |
{ | |
register_shutdown_function([$this, 'run']); | |
} | |
public function run() | |
{ | |
foreach ($this->callables as $callable) { | |
$callable(); | |
} | |
} | |
} | |
$app = new App(); | |
$app->callables[] = function() { echo 'yay'; }; | |
$app->callables[] = function() { echo 'foo'; }; | |
$app->callables[] = function() { echo 'bar'; }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment