3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getRandomString($n) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ=+/'; $randomString = ''; for ($i = 0; $i < $n; $i++) { $index = rand(0, strlen($characters) - 1); $randomString .= $characters[$index]; } return $randomString; } foreach (['foo', 'bar', getRandomString(100), getRandomString(2000), '', getRandomString(2000)] as $data) { $hash = base64_encode(hash('sha256', $data, TRUE)); print base64_encode(hash('sha256', $data, TRUE)) . ' : '; // Modify the hash so it's safe to use in URLs. $hashed = str_replace(['+', '/', '='], ['-', '_', ''], $hash); print $hashed . ' : '; print strlen($hashed) . PHP_EOL; }

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.2.70.0190.00379.33
8.2.60.0140.00679.33
8.2.50.0190.00079.33
8.2.40.0110.00679.33
8.2.30.0130.00479.33
8.2.20.0070.01179.33
8.2.10.0120.00579.33
8.2.00.0080.00879.33
8.1.200.0090.00979.33
8.1.190.0080.00879.33
8.1.180.0180.00379.33
8.1.170.0070.01179.33
8.1.160.0120.00479.33
8.1.150.0170.00079.33
8.1.140.0170.00079.33
8.1.130.0050.01179.33
8.1.120.0100.00679.33
8.1.110.0140.00379.33
8.1.100.0170.00079.33
8.1.90.0140.00279.33
8.1.80.0100.00779.33
8.1.70.0130.00479.33
8.1.60.0150.00479.33
8.1.50.0170.00479.33
8.1.40.0160.00379.33
8.1.30.0090.00979.33
8.1.20.0090.00979.33
8.1.10.0190.00079.33
8.1.00.0110.00779.33
8.0.290.0150.00279.33
8.0.280.0150.00479.33
8.0.270.0140.00379.33
8.0.260.0140.00579.33
8.0.250.0160.00079.33
8.0.240.0150.00279.33
8.0.230.0080.00879.33
8.0.220.0130.00379.33
8.0.210.0100.00779.33
8.0.200.0130.00479.33
8.0.190.0080.00879.33
8.0.180.0080.00879.33
8.0.170.0170.00079.33
8.0.160.0100.00779.33
8.0.150.0120.00679.33
8.0.140.0180.00079.33
8.0.130.0140.00479.33
8.0.120.0130.00379.33
8.0.110.0070.01079.33
8.0.100.0080.00879.33
8.0.90.0140.00279.33
8.0.80.0090.00979.33
8.0.70.0150.00479.33
8.0.60.0200.00079.33
8.0.50.0160.00079.33
8.0.30.0130.00379.33
8.0.20.0130.00379.33
8.0.10.0160.00279.33

preferences:
25.82 ms | 403 KiB | 5 Q