| Conditions | 5 |
| Paths | 9 |
| Total Lines | 27 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | public function test() |
||
| 18 | { |
||
| 19 | $field = 'user'; |
||
| 20 | echo "class find\r\n"; |
||
| 21 | |||
| 22 | $t1 = microtime(true); |
||
| 23 | foreach (range(1,500) as $a){ |
||
| 24 | $func = "get".$field; |
||
| 25 | if (is_callable([$this,$func])) { |
||
| 26 | call_user_func([$this,$func]); |
||
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | var_dump(microtime(true)-$t1); |
||
|
|
|||
| 31 | |||
| 32 | |||
| 33 | |||
| 34 | echo "array find\r\n"; |
||
| 35 | $t1 = microtime(true); |
||
| 36 | foreach (range(1,500) as $a) { |
||
| 37 | $a = ['set.user' => 'getuser', 'get.user' => 'getuser']; |
||
| 38 | $func = 'set.' . $field; |
||
| 39 | if (isset($a[$func])) { |
||
| 40 | call_user_func([$this, $a[$func]]); |
||
| 41 | } |
||
| 42 | } |
||
| 43 | var_dump(microtime(true)-$t1); |
||
| 44 | } |
||
| 58 |