- substr: documentation ( source)
- var_dump: documentation ( source)
- microtime: documentation ( source)
- array_reverse: documentation ( source)
- base64_encode: documentation ( source)
- md5: documentation ( source)
<?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);