3v4l.org

run code in 500+ PHP versions simultaneously
<?php // // // CSDROP Provably Fair Case Battles // // // /* * Fill in all three below and click the blue 'eval();' button. ------------------ */ $server_seed = ''; $client_seed = ''; $nonce = $roundNumber = 0; /* ------------------ */ if ($server_seed == '' || $client_seed == '' || $nonce < 0) { echo "Fill in details"; return; } define('MIN_RESULT', 0.00001); define('MAX_RESULT', 100); define('CONVERT_RATE', 100000); define('HASH_TYPE', 'sha256'); function getProvablyFairResult(string $client_seed, string $server_seed, int $nounce) { $hash = hash_hmac(HASH_TYPE, "{$client_seed}-{$nounce}", $server_seed); $normalized = hexdec($hash) / (16 ** strlen($hash)); $roll = MIN_RESULT + $normalized * (MAX_RESULT - MIN_RESULT); return convertDecimalValue($roll); } function convertDecimalValue(float $value): int { return round($value * CONVERT_RATE); } $result = getProvablyFairResult($client_seed, $server_seed, $nonce); echo "Result: {$result}";

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.5.30.0230.00818.06
8.5.20.0260.00717.17
8.5.10.0340.00616.69
8.5.00.0260.00816.58
8.4.180.0310.00819.63
8.4.170.0280.00919.91
8.4.160.0280.01120.43
8.4.150.0270.01019.63
8.4.140.0330.00917.42
8.4.130.0280.01017.50
8.4.120.0330.00717.65
8.4.110.0330.01117.65
8.4.100.0330.01017.74
8.4.90.0370.00817.62
8.4.80.0380.00817.66
8.4.70.0350.00717.85
8.4.60.0360.00917.62
8.4.50.0340.01017.67
8.4.40.0370.01017.41
8.4.30.0360.00817.64
8.4.20.0430.00817.51
8.4.10.0370.00718.11
8.3.300.0280.01119.16
8.3.290.0370.00918.35
8.3.280.0320.00718.24
8.3.270.0380.01016.69
8.3.260.0360.00916.64
8.3.250.0390.00916.66
8.3.240.0300.00816.75
8.3.230.0370.00816.69
8.3.220.0350.00816.66
8.3.210.0330.00616.68
8.3.200.0320.00816.65
8.3.190.0330.00816.68
8.3.180.0360.00916.65
8.3.170.0420.00916.79
8.3.160.0360.00916.63
8.3.150.0340.01017.13
8.3.140.0320.00716.63
8.3.130.0270.00716.74
8.3.120.0260.00616.76
8.3.110.0270.00716.68
8.3.100.0340.00816.77
8.3.90.0320.00916.57
8.3.80.0340.00616.63
8.3.70.0330.00716.70
8.3.60.0310.00816.60
8.3.50.0310.00716.64
8.3.40.0260.00517.91
8.3.30.0200.00717.72
8.3.20.0250.00617.82
8.3.10.0230.00817.81
8.3.00.0220.00717.79

preferences:
41.76 ms | 699 KiB | 5 Q