Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Hello
- {
- public function world($a, $b)
- {
- }
- }
- $hello = new Hello();
- $method = 'world';
- $start = microtime(true);
- for ($i = 0; $i < 10000000; $i++) {
- call_user_func_array([$hello, $method], ['1', '2']);
- }
- $end = microtime(true);
- echo ($end - $start) . "\n";
- execution:
- 10.178316116333
- 9.7171959877014
- 9.8346889019012
- 9.7570450305939
- 9.6631968021393
- // ===============================================================
- <?php
- class Hello
- {
- public function world($a, $b)
- {
- }
- }
- $hello = new Hello();
- $method = 'world';
- $start = microtime(true);
- for ($i = 0; $i < 10000000; $i++) {
- $hello->$method('1', '2');
- }
- $end = microtime(true);
- echo ($end - $start) . "\n";
- execution:
- 3.1567089557648
- 3.1002268791199
- 3.1486649513245
- 3.0142378807068
- 2.9824171066284
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement