-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathphp8.inc
More file actions
49 lines (44 loc) · 1.25 KB
/
php8.inc
File metadata and controls
49 lines (44 loc) · 1.25 KB
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
<?php
/**
* php safe options - php8 only functions or syntax
* Php 8.0+
*/
/** ---------------------------------- Tests functions -------------------------------------------- */
function test_37_01_php8_Str_Contains()
{
global $testsLoopLimits, $totalOps;
$count = $testsLoopLimits['37_01_php8_str_contains'];
$time_start = get_microtime();
$s = "Foobar";
$n = "Foo";
$found=0;
for ($i = 0; $i < $count; ++$i) {
$f = str_contains($s, $n);
if ($f) $found++;
// Work-around for opCache 8.0+ code elimination, maybe
//$s .= ($i % 111) ? PHP_EOL : '!';
}
$totalOps += $count;
$memory = mymemory_usage();
unset($s);
return format_result_test(get_microtime() - $time_start, $count , $memory);
}
function test_37_02_php8_Str_Contains_emulate()
{
global $testsLoopLimits, $totalOps;
$count = $testsLoopLimits['37_02_php8_str_contains_emulate'];
$time_start = get_microtime();
$s = "Foobar";
$n = "Foo";
$found=0;
for ($i = 0; $i < $count; ++$i) {
$f = strpos($s, $n);
if ($f !== false) $found++;
// Work-around for opCache 8.0+ code elimination, maybe
//$s .= ($i % 111) ? PHP_EOL : '!';
}
$totalOps += $count;
$memory = mymemory_usage();
unset($s);
return format_result_test(get_microtime() - $time_start, $count , $memory);
}