- strtoupper: documentation ( source)
- hrtime: documentation ( source)
- printf: documentation ( source)
<?php
namespace foo;
const N = 100_000_000;
function without_backslash() {
$start = \hrtime(true);
$tmp = [];
for($i = 0; $i < 10000; $i++) {
$tmp[] = strtoupper("test" . $i);
}
$stop = \hrtime(true);
\printf("Without backslash: %f s\n", ($stop - $start)/1e9);
}
function with_backslash() {
$start = \hrtime(true);
$tmp = [];
for($i = 0; $i < 10000; $i++) {
$tmp[] = \strtoupper("test" . $i);
}
$stop = \hrtime(true);
\printf("With backslash: %f s\n", ($stop - $start)/1e9);
}
without_backslash();
with_backslash();
printf("\n");
without_backslash();
with_backslash();
printf("\n");
without_backslash();
with_backslash();
printf("\n");
without_backslash();
with_backslash();
printf("\n");