<?php
$test = function($p = 'abcde', $c = 'abc')
{
return substr($p, 0, strlen($c)) == $c;
};
$test1 = function($p = 'abcde', $c = 'abc')
{
return strncmp($p, $c, strlen($c));
};
$print = function($closure, $s, $cycles = 10000000)
{
for ($i =0; $i < $cycles; $i++) {
$closure();
}
echo printf('Runns: %01.2f', microtime(1) - $s);
echo PHP_EOL;
};
$print($test, microtime(1));
$print($test1, microtime(1));
- Output for 7.2.0
- Runns: 0.8111
Runns: 0.6511
- Output for 7.1.7
- Runns: 0.8911
Runns: 1.0211
- Output for 7.1.6
- Runns: 0.8611
Runns: 0.9911
- Output for 7.1.5
- Runns: 0.9011
Runns: 0.9611
- Output for 7.1.0
- Runns: 0.8811
Runns: 1.1811
- Output for 7.0.20
- Runns: 0.9711
Runns: 1.0711
- Output for 7.0.14
- Runns: -0.6412
Runns: 2.7911
- Output for 7.0.6
- Runns: 0.8111
Runns: 0.9611
- Output for 7.0.5
- Runns: 0.8411
Runns: 0.9811
- Output for 7.0.4
- Runns: 0.7911
Runns: 0.9911
- Output for 7.0.3
- Runns: 0.8311
Runns: 0.9711
- Output for 7.0.2
- Runns: 0.8111
Runns: 0.9111
- Output for 7.0.1
- Runns: 0.8311
Runns: 0.9411
- Output for 7.0.0
- Runns: 0.8511
Runns: 0.9211
- Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Process exited with code 137.- Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
- Parse error: syntax error, unexpected T_FUNCTION in /in/nSGcX on line 3
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
- Parse error: parse error, unexpected T_FUNCTION in /in/nSGcX on line 3
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error in /in/nSGcX on line 3
Process exited with code 255.
preferences:
114.76 ms | 401 KiB | 174 Q