Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions loops/php/code.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

function main(int $u)
{
$r = rand(0, 10000); # Get a random number 0 <= r < 10k
$a = array_fill(0, 10000, 0); # Array of 10k elements initialized to 0
$r = mt_rand(0, 10000); # Get a random number 0 <= r < 10k
$a = new SplFixedArray(10000); # Array of 10k elements initialized to 0
for ($i = 0; $i < 10000; $i++) { # 10k outer loop iterations
for ($j = 0; $j < 100000; $j++) { # 100k inner loop iterations, per outer loop iteration
$a[$i] += $j%$u; # Simple sum
Expand Down