<?php
$value = base64_encode(md5(''));
$start = microtime(true);
for ($i = 0; $i < 100; ++$i) {
$result = [];
do {
$result[] = $value;
$value = substr($value, 0, -1);
} while ('' !== $value);
$result = array_reverse($result);
}
$end = microtime(true);
echo $i/($end - $start), ' op/s', PHP_EOL;
var_dump($result);
- Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.13, 7.3.0 - 7.3.1
- Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 67108872 bytes) in /in/NkXgP on line 8
Process exited with code 255. - Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
- Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in /in/NkXgP on line 9
Process exited with code 255. - Output for 5.3.7 - 5.3.29
- Parse error: syntax error, unexpected '[' in /in/NkXgP on line 6
Process exited with code 255.
preferences:
96.69 ms | 401 KiB | 130 Q