Skip to content

Instantly share code, notes, and snippets.

@loganlinn
Created January 15, 2014 19:02
Show Gist options
  • Save loganlinn/8442205 to your computer and use it in GitHub Desktop.
Save loganlinn/8442205 to your computer and use it in GitHub Desktop.
<?php
class Bomb {
function disarm() {
echo "Disarming...\n";
}
function __call($method, $args) {
echo "Bomb::__call('$method', ...)\n";
}
}
class BombDecorator extends Bomb {
function __call($method, $args) {
echo "Calling parent::$method\n";
//return call_user_func_array("parent::$method", $args);
return call_user_func("parent::__call", $method, $args);
}
}
$b = new BombDecorator();
$i = 10000;
$t = microtime(true);
while($i--) {
$b->arm();
$b->disarm();
}
$t = microtime(true) - $t;
var_dump($t);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment