// Created on savesnippets.com ยท https://savesnippets.com/3ssnxCsYaaNFjo $result, 'ms' => $elapsedNs / 1_000_000, ]; } $bench = benchmark(function () { return array_sum(range(1, 1_000_000)); }); printf("Result: %d took %.2f ms\n", $bench['result'], $bench['ms']); // Result: 500000500000 took 12.34 ms