-
Notifications
You must be signed in to change notification settings - Fork 0
/
in_array.php
69 lines (52 loc) · 1.09 KB
/
in_array.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
#$INTERVAL = 1_000_000_000;
$INTERVAL = 100_000_000;
#$INTERVAL = 1_000_000;
#$INTERVAL = 100_000;
$search = "timeouted";
#$search = "update_core";
echo "in_array ";
$stop = $INTERVAL;
$start = microtime(true);
$array = array( 'update_core', 'update_plugins', 'update_themes' );
while(--$stop)
{
if( ! in_array( $search, $array, true ) ){
/*
* Put Code Here
*/
}
}
echo number_format(microtime(true) - $start, 5)."\n\n";
echo "if && ";
$stop = $INTERVAL;
$start = microtime(true);
while(--$stop)
{
if ( $search !== 'update_plugins' && $search !== 'update_themes' && $search !== 'update_core' ) {
/*
* Put Code Here
*/
}
}
echo number_format(microtime(true) - $start, 5)."\n\n";
echo "if else ";
$stop = $INTERVAL;
$start = microtime(true);
while(--$stop)
{
if ( $search !== 'update_plugins' || $search !== 'update_themes' || $search !== 'update_core' ) {
/*
* Nothing Here
*/
}else{
/*
* Put Code Here
*/
}
}
echo number_format(microtime(true) - $start, 5)."\n\n";
//OUTPUT
//in_array 2.32199
//if && 2.66951
//if else 1.28673