3v4l.org

run code in 500+ PHP versions simultaneously
<?php // https://www.strangebuzz.com/en/snippets/convert-a-string-into-an-array-of-characters $tokenSize = 32; try { $random = random_bytes($tokenSize); } catch (\Exception $e) { throw new \RuntimeException('Unable to get random_bytes.'); } $base = base64_encode($random); $clean = str_replace(str_split('+/-_'), '', $base); $cut = substr($clean, 0, $tokenSize); echo 'Token: '.$cut."\n"; echo 'Token length: '.strlen($cut);

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)
7.4.10.0130.01314.55
7.4.00.0100.00614.69
7.3.130.0090.01214.73
7.3.120.0120.00914.73
7.3.110.0090.00814.65
7.3.100.0130.00614.70
7.3.90.0100.00814.93
7.3.80.0090.01014.73
7.3.70.0100.00714.65
7.3.60.0120.00914.64
7.3.50.0080.01314.74
7.3.40.0090.00914.45
7.3.30.0110.00714.64
7.3.20.0130.00614.88
7.3.10.0080.01114.70
7.3.00.0070.00914.80
7.2.260.0210.00414.73
7.2.250.0100.00715.09
7.2.240.0100.01015.04
7.2.230.0140.01014.86
7.2.220.0070.00914.75
7.2.210.0100.00614.74
7.2.200.0110.00714.98
7.2.190.0100.00714.69
7.2.180.0170.00614.78
7.2.170.0080.00814.88
7.2.160.0030.01615.18
7.2.150.0070.01015.13
7.2.140.0030.01415.02
7.2.130.0100.00715.19
7.2.120.0090.00614.83
7.2.110.0140.00314.73
7.2.100.0070.00714.82
7.2.90.0050.01114.69
7.2.80.0160.00315.20
7.2.70.0060.01215.07
7.2.60.0090.00614.89
7.2.50.0100.00715.13
7.2.40.0780.00314.94
7.2.30.0100.01315.14
7.2.20.0070.00715.00
7.2.10.0080.00615.05
7.2.00.0050.00815.03
7.1.330.0060.00713.73
7.1.320.0090.00514.04
7.1.310.0080.00813.88
7.1.300.0060.00613.76
7.1.290.0130.00713.87
7.1.280.0050.01114.00
7.1.270.0070.01013.83
7.1.260.0080.00813.83

preferences:
58.77 ms | 688 KiB | 5 Q