Created
January 15, 2014 19:02
-
-
Save loganlinn/8442205 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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