3v4l.org

run code in 300+ PHP versions simultaneously
<?php function _random(string $set , int $length): string { $setLength = strlen($set); $randomKey = random_int(0, $setLength - 1); $firstPiece = substr($set, 0, $randomKey); $secondPiece = substr($set, $randomKey, $setLength - $randomKey); $removedCharacter = $firstPiece[strlen($firstPiece) - 1] ?? null; if(null === $removedCharacter || $length === 0) { return ''; } $firstPieceWithoutTheLastChar = substr($firstPiece, 0, -1); return $removedCharacter . _random($firstPieceWithoutTheLastChar . $secondPiece, $length - 1); } $a = _random('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 32); $b = _random('abcdefghijklmnopqrstuvwxyz', 8); $c = _random('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 64); var_dump($a, $b, $c);

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.1.110.0050.00217.46
8.1.100.0080.01217.31
8.1.90.0100.00517.49
8.1.80.0140.00517.52
8.1.70.0100.00617.46
8.1.60.0100.00917.44
8.1.50.0110.00817.47
8.1.40.0180.00017.56
8.1.30.0090.00917.57
8.1.20.0160.00317.54
8.1.10.0130.00417.48
8.1.00.0090.00917.56
8.0.240.0000.01516.95
8.0.230.0170.00016.80
8.0.220.0130.00516.82
8.0.210.0090.00616.95
8.0.200.0070.00816.90
8.0.190.0120.00316.81
8.0.180.0140.00216.89
8.0.170.0090.00616.71
8.0.160.0100.00716.87
8.0.150.0040.01116.76
8.0.140.0150.00016.72
8.0.130.0150.00016.84
8.0.120.0150.00016.79
8.0.110.0000.01416.94
8.0.100.0110.00416.82
8.0.90.0160.00016.89
8.0.80.0120.00416.97
8.0.70.0120.00316.84
8.0.60.0050.01116.73
8.0.50.0080.00816.90
8.0.30.0120.00516.73
8.0.20.0080.00816.88
8.0.10.0060.01016.84
7.4.300.0120.00416.61
7.4.290.0120.00616.45
7.4.280.0160.00016.62
7.4.270.0050.01116.62
7.4.260.0070.01116.48
7.4.250.0050.00716.61
7.4.240.0130.00216.36
7.4.230.0150.00316.45
7.4.220.0070.00716.49
7.4.210.0080.00516.51
7.4.200.0110.00416.50
7.4.190.0150.00016.58
7.4.180.0000.00816.46
7.4.160.0100.00016.47
7.4.150.0060.00616.66
7.4.140.0030.00616.33
7.4.130.0020.00716.46
7.4.120.0080.00416.43
7.4.110.0140.00016.45
7.4.100.0100.00716.41
7.4.90.0110.00516.32
7.4.80.0050.01016.59
7.4.70.0070.00716.50
7.4.60.0090.00616.52
7.4.50.0150.00016.39
7.4.40.0150.00016.35
7.4.30.0050.00916.38
7.4.20.0150.00016.35
7.4.10.0000.01416.59
7.4.00.0030.01116.52
5.3.290.0020.00514.33

preferences:
37.81 ms | 403 KiB | 5 Q