3v4l.org

run code in 300+ PHP versions simultaneously
<?php $hashAlgo = 'sha384'; //$hashAlgo = 'sha256'; $maxHeaderLength = 2048; // $maxHeaderLength = 3072; // Do not change after here $baseCsp = "default-src 'self'; report-uri https://www.my-super-domain.com/_contao/csp/report/51; style-src 'self' 'unsafe-hashes' 'nonce-H0Sss0Ol1d/r/rgWp4sRk3IT'; script-src 'self' 'unsafe-hashes' 'nonce-H0Sss0Ol1d/r/rgWp4sRk3IT'"; // + 3 for wrapping '' and space $lengthOfOneHash = strlen($hashAlgo . '-' . base64_encode(hash($hashAlgo, 'text-decoration: underline'))) + 3; $count = 0; $total = strlen($baseCsp); while (true) { $total += $lengthOfOneHash; if ($total > $maxHeaderLength) { echo 'Could fit ' . $count . ' hashes in the CSP header.'; break; } $count++; }

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.3.70.0070.01516.71
8.3.60.0100.01018.52
8.3.50.0070.01016.78
8.3.40.0100.00721.86
8.3.30.0070.00722.14
8.3.20.0120.00625.66
8.3.10.0140.00425.66
8.3.00.0090.00925.66
8.2.190.0090.00916.58
8.2.180.0070.01018.53
8.2.170.0110.00418.96
8.2.160.0030.01322.96
8.2.150.0150.00325.66
8.2.140.0110.00725.66
8.2.130.0070.01125.66
8.2.120.0120.00625.66
8.2.110.0070.01125.66
8.2.100.0090.00925.66
8.2.90.0040.01825.66
8.2.80.0040.01125.66
8.2.70.0100.01025.66
8.2.60.0150.00025.66
8.2.50.0110.00425.66
8.2.40.0090.00625.66
8.2.30.0150.00025.66
8.2.20.0070.00725.66
8.2.10.0070.00725.66
8.2.00.0120.00325.66
8.1.280.0060.01225.92
8.1.270.0080.00625.66
8.1.260.0000.01425.66
8.1.250.0130.00325.66
8.1.240.0130.00725.66
8.1.230.0110.00425.66
8.1.220.0060.00625.66
8.1.210.0050.00325.66
8.1.200.0120.00325.66
8.1.190.0090.00625.66
8.1.180.0060.00925.66
8.1.170.0130.00625.66
8.1.160.0070.01125.66
8.1.150.0100.00625.66
8.1.140.0090.00625.66
8.1.130.0000.01525.66
8.1.120.0110.00425.66
8.1.110.0150.00025.66
8.1.100.0160.00325.66
8.1.90.0030.00625.66
8.1.80.0080.00825.66
8.1.70.0130.00325.66
8.1.60.0050.00325.66
8.1.50.0090.00625.66
8.1.40.0150.00025.66
8.1.30.0040.00425.66
8.1.20.0040.00425.66
8.1.10.0040.00425.66
8.1.00.0080.00025.66

preferences:
40.27 ms | 401 KiB | 5 Q