Issues (37)

work2.php (1 issue)

1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: hooklife
5
 * Date: 2018/10/25
6
 * Time: 4:26
7
 */
8
9
10
class Table{
11
    public function getuser()
12
    {
13
        return "ok";
14
    }
15
16
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 (method_exists($this,$func)) {
26
                call_user_func([$this,$func]);
27
            }
28
        }
29
30
        var_dump(microtime(true)-$t1);
0 ignored issues
show
Security Debugging Code introduced by
var_dump(microtime(true) - $t1) looks like debug code. Are you sure you do not want to remove it?
Loading history...
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
    }
45
}
46
47
48
49
50
(new Table())->test();
51
52
53
54
55
56
57
58