3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @param string $password * @param string|null $salt */ function crypt_apr1_md5($password, $salt = null) { if (!$salt) { $salt = substr(base_convert(bin2hex(random_bytes(6)), 16, 36), 1, 8); } $len = strlen($password); $text = $password . '$apr1$' . $salt; $bin = pack("H32", md5($password . $salt . $password)); for ($i = $len; $i > 0; $i -= 16) { $text .= substr($bin, 0, min(16, $i)); } for ($i = $len; $i > 0; $i >>= 1) { $text .= ($i & 1) ? chr(0) : $password[0]; } $bin = pack("H32", md5($text)); for ($i = 0; $i < 1000; $i++) { $new = ($i & 1) ? $password : $bin; if ($i % 3) { $new .= $salt; } if ($i % 7) { $new .= $password; } $new .= ($i & 1) ? $bin : $password; $bin = pack("H32", md5($new)); } $tmp = ''; for ($i = 0; $i < 5; $i++) { $k = $i + 6; $j = $i + 12; if ($j == 16) { $j = 5; } $tmp = $bin[$i] . $bin[$k] . $bin[$j] . $tmp; } $tmp = chr(0) . chr(0) . $bin[11] . $tmp; $tmp = strtr( strrev(substr(base64_encode($tmp), 2)), "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" ); return "$" . "apr1" . "$" . $salt . "$" . $tmp; } $salt = substr(base_convert(bin2hex(random_bytes(6)), 16, 36), 1, 8); var_dump( crypt_apr1_md5('password', $salt), crypt_apr1_md5('password', $salt) ); var_dump( crypt_apr1_md5('password'), crypt_apr1_md5('password') );

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.10.0120.01122.90
8.2.140.0120.00922.02
8.2.20.0090.00718.70
8.1.100.0070.00617.43
8.1.90.0140.00517.43
8.1.80.0080.01117.47
8.1.70.0120.00817.43
8.1.60.0100.00817.57
8.1.50.0110.00817.53
8.1.40.0110.00717.50
8.1.30.0100.00817.66
8.1.20.0120.00817.61
8.1.10.0130.00817.57
8.1.00.0130.00817.55
8.0.230.0090.00817.00
8.0.220.0110.00616.93
8.0.210.0100.00716.85
8.0.200.0120.00616.95
8.0.190.0110.00616.95
8.0.180.0120.00516.88
8.0.170.0110.00616.90
8.0.160.0120.00616.88
8.0.150.0110.00616.81
8.0.140.0060.01116.85
8.0.130.0110.00716.84
8.0.120.0090.00716.86
8.0.110.0070.01016.88
8.0.100.0100.00816.91
8.0.90.0100.00916.89
8.0.80.0090.00916.82
8.0.70.0120.00816.94
8.0.60.0110.00716.84
8.0.50.0140.00516.86
8.0.30.0070.01016.92
8.0.20.0120.00617.00
8.0.10.0150.00416.98
8.0.00.0090.01016.91
7.4.300.0100.00916.57
7.4.290.0110.00716.55
7.4.280.0150.00416.57
7.4.270.0130.00716.57
7.4.260.0120.00816.50
7.4.250.0110.00815.45
7.4.240.0140.00616.55
7.4.230.0130.00716.59
7.4.220.0080.01016.58
7.4.210.0090.00816.55
7.4.200.0080.00816.46
7.4.190.0100.00716.51
7.4.180.0130.00416.58
7.4.160.0110.00716.54
7.4.150.0100.00716.54
7.4.140.0080.01016.41
7.4.130.0090.00816.48
7.4.120.0110.00616.40
7.4.110.0100.00716.42
7.4.100.0080.00916.47
7.4.90.0080.00916.46
7.4.80.0060.01216.38
7.4.70.0070.01016.43
7.4.60.0070.01016.45
7.4.50.0070.01016.36
7.4.40.0060.01116.38
7.4.30.0090.00716.39
7.4.20.0090.00916.40
7.4.10.0090.00916.45
7.4.00.0090.01216.16
7.3.330.0110.00716.35
7.3.320.0120.00616.33
7.3.310.0100.00816.32
7.3.300.0140.00416.34
7.3.290.0130.00416.31
7.3.280.0150.00416.28
7.3.270.0120.00616.42
7.3.260.0140.00316.32
7.3.250.0120.00716.45
7.3.240.0130.00716.42
7.3.230.0100.00916.35
7.3.220.0120.00716.42
7.3.210.0130.00716.34
7.3.200.0130.00916.36
7.3.190.0120.00816.37
7.3.180.0110.01016.39
7.3.170.0100.01016.46
7.3.160.0130.00616.37
7.3.150.0100.00816.37
7.3.140.0120.00816.40
7.3.130.0120.00816.32
7.3.120.0090.01016.13
7.3.110.0110.00916.09
7.3.100.0100.01016.03
7.3.90.0080.01216.22
7.3.80.0070.01316.13
7.3.70.0100.01016.08
7.3.60.0110.00816.01
7.3.50.0090.01215.89
7.3.40.0070.01315.89
7.3.30.0100.01115.89
7.3.20.0090.01316.42
7.3.10.0110.00916.42
7.3.00.0100.01016.34
7.2.340.0110.01116.54
7.2.330.0120.01116.57
7.2.320.0130.01016.57
7.2.310.0130.00916.48
7.2.300.0120.01016.51
7.2.290.0120.01116.57
7.2.280.0120.01016.56
7.2.270.0140.00816.53
7.2.260.0100.01216.57
7.2.250.0100.01316.33
7.2.240.0120.01116.35
7.2.230.0120.00916.30
7.2.220.0110.01216.29
7.2.210.0120.01016.24
7.2.200.0110.01116.30
7.2.190.0100.01216.19
7.2.180.0120.01216.03
7.2.170.0110.01016.14
7.2.160.0130.01016.09
7.2.150.0170.01316.59
7.2.140.0160.01316.59
7.2.130.0120.01116.69
7.2.120.0120.01116.62
7.2.110.0180.01116.50
7.2.100.0160.01116.47
7.2.90.0210.01016.46
7.2.80.0220.01016.48
7.2.70.0170.01216.48
7.2.60.0180.01016.47
7.2.50.0190.01016.43
7.2.40.0140.01017.08
7.2.30.0190.01116.47
7.2.20.0150.01016.50
7.2.10.0180.01316.43
7.2.00.0170.01116.51
7.1.330.0110.01415.81
7.1.320.0180.01015.89
7.1.310.0150.01215.86
7.1.300.0140.01015.58
7.1.290.0130.01215.64
7.1.280.0210.01015.49
7.1.270.0170.01115.47
7.1.260.0190.01015.46
7.1.250.0160.01115.38
7.1.240.0130.01315.37
7.1.230.0250.01315.32
7.1.220.0210.01115.30
7.1.210.0280.00915.27
7.1.200.0240.01015.25
7.1.190.0210.01115.21
7.1.180.0220.01115.26
7.1.170.0220.01115.29
7.1.160.0200.01115.28
7.1.150.0260.01115.24
7.1.140.0220.01115.24
7.1.130.0210.01015.31
7.1.120.0200.01415.23
7.1.110.0170.01215.28
7.1.100.0130.01315.28
7.1.90.0150.01315.23
7.1.80.0140.01215.32
7.1.70.0200.01015.28
7.1.60.0170.01116.87
7.1.50.0200.01116.64
7.1.40.0170.01216.67
7.1.30.0160.01216.65
7.1.20.0170.01116.61
7.1.10.0170.01215.10
7.1.00.0200.01315.08
7.0.330.0140.01115.01
7.0.320.0130.01115.64
7.0.310.0130.01215.65
7.0.300.0130.01115.66
7.0.290.0160.01015.63
7.0.280.0190.01015.67
7.0.270.0150.01115.67
7.0.260.0170.01115.66
7.0.250.0120.01315.78
7.0.240.0130.01415.78
7.0.230.0160.01115.75
7.0.220.0130.01215.80
7.0.210.0140.01215.75
7.0.200.0190.01215.51
7.0.190.0160.01115.47
7.0.180.0160.01115.51
7.0.170.0180.01015.55
7.0.160.0180.01015.43
7.0.150.0210.00915.50
7.0.140.0250.01215.48
7.0.130.0150.01115.53
7.0.120.0150.01215.52
7.0.110.0120.01315.45
7.0.100.0160.01015.49
7.0.90.0140.01215.42
7.0.80.0140.01115.48
7.0.70.0140.01215.49
7.0.60.0180.01215.46
7.0.50.0180.01015.44
7.0.40.0140.01215.49
7.0.30.0180.01015.50
7.0.20.0160.01215.43
7.0.10.0140.01115.48
7.0.00.0140.01315.47
5.6.400.0140.00715.22
5.6.390.0120.00815.20
5.6.380.0130.00715.12
5.6.370.0160.00615.63
5.6.360.0120.00915.65
5.6.350.0150.00815.63
5.6.340.0140.00915.71
5.6.330.0120.01115.64
5.6.320.0100.01215.73
5.6.310.0150.00815.59
5.6.300.0160.00615.52
5.6.290.0170.00715.65
5.6.280.0160.00915.68
5.6.270.0140.00915.67
5.6.260.0160.00615.69
5.6.250.0160.00615.68
5.6.240.0140.00815.63
5.6.230.0160.00615.67
5.6.220.0140.00915.65
5.6.210.0130.01015.70
5.6.200.0140.00915.71
5.6.190.0140.00815.75
5.6.180.0150.00815.64
5.6.170.0140.00815.68
5.6.160.0130.01015.69
5.6.150.0130.01015.67
5.6.140.0150.00915.69
5.6.130.0150.00715.78
5.6.120.0140.00915.67
5.6.110.0160.00715.67
5.6.100.0140.00915.71
5.6.90.0150.00815.69
5.6.80.0180.00615.59
5.6.70.0140.01015.71
5.6.60.0160.00715.67
5.6.50.0180.00615.62
5.6.40.0140.00915.67
5.6.30.0130.00815.66
5.6.20.0130.01115.51
5.6.10.0150.00715.66
5.6.00.0150.00715.50

preferences:
47.69 ms | 401 KiB | 5 Q