3v4l.org

run code in 300+ PHP versions simultaneously
<?php class passwordHash { // blowfish private static $algo = '$2a'; // cost parameter private static $cost = '$10'; // mainly for internal use public static function unique_salt() { return substr(sha1(mt_rand()), 0, 22); } // this will be used to generate a hash public static function hash($password) { return crypt($password, self::$algo . self::$cost . '$' . self::unique_salt()); } // this will be used to compare a password against a hash public static function check_password($hash, $password) { $full_salt = substr($hash, 0, 29); $new_hash = crypt($password, $full_salt); return ($hash == $new_hash); } } $pw = 'test'; print( passwordHash::hash($pw) );

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.00.0030.07914.74
7.3.120.0100.07114.71
7.3.110.0130.07014.57
7.3.100.0070.07214.62
7.3.90.0060.06714.84
7.3.80.0030.07514.77
7.3.70.0030.07014.68
7.3.60.0070.06614.83
7.3.50.0100.06114.48
7.3.40.0070.06714.90
7.3.30.0030.07314.83
7.3.20.0030.07116.67
7.3.10.0030.07216.81
7.3.00.0070.06716.61
7.2.250.0070.07814.96
7.2.240.0030.08014.94
7.2.230.0070.07115.21
7.2.220.0030.07314.96
7.2.210.0130.06615.23
7.2.200.0030.06915.07
7.2.190.0030.07215.01
7.2.180.0030.06815.07
7.2.170.0070.06815.28
7.2.00.0030.07218.94
7.1.330.0030.07015.64
7.1.320.0000.07315.46
7.1.310.0070.06715.68
7.1.300.0130.06215.88
7.1.290.0030.06615.48
7.1.280.0100.06415.45
7.1.270.0070.07015.52
7.1.260.0000.07315.88
7.1.70.0030.06817.14
7.1.60.0130.12219.50
7.1.50.0070.12616.97
7.1.00.0100.16022.37
7.0.200.0000.06816.73
7.0.60.0170.17720.09
7.0.50.0070.15717.85
7.0.40.0000.11720.04
7.0.30.0370.10720.30
7.0.20.0200.11320.19
7.0.10.0070.12020.22
7.0.00.0070.11020.18
5.6.280.0030.16321.08
5.6.210.0130.14320.61
5.6.200.0070.11718.24
5.6.190.0070.16020.52
5.6.180.0230.10020.39
5.6.170.0130.10320.66
5.6.160.0030.10320.52
5.6.150.0000.15318.18
5.6.140.0070.12718.28
5.6.130.0100.16018.24
5.6.120.0100.16020.94
5.6.110.0030.18321.05
5.6.100.0170.17021.14
5.6.90.0070.16321.14
5.6.80.0130.15020.53
5.5.350.0170.14720.44
5.5.340.0070.15718.04
5.5.330.0070.12720.47
5.5.320.0430.14020.30
5.5.310.0300.10720.30
5.5.300.0230.14017.98
5.5.290.0070.09717.94
5.5.280.0070.13320.68
5.5.270.0070.10320.76
5.5.260.0170.16320.77
5.5.250.0100.10720.62
5.5.240.0270.15020.08
5.4.450.0070.10019.55
5.4.440.0300.10019.32
5.4.430.0870.09319.27
5.4.420.0100.14019.38
5.4.410.0100.15018.95
5.4.400.0170.15018.85
5.4.390.0070.13718.48
5.4.380.0130.13018.46
5.4.370.0070.14018.82
5.4.360.0170.15318.71
5.4.350.0170.15718.69
5.4.340.0070.14018.77
5.4.320.0170.15018.51
5.4.310.0130.13318.73
5.4.300.0100.14018.55
5.4.290.0130.13318.76
5.4.280.0130.14718.51
5.4.270.0030.16718.68
5.4.260.0130.13018.68
5.4.250.0070.14018.49
5.4.240.0100.14718.45
5.4.230.0270.12718.71
5.4.220.0270.14718.58
5.4.210.0170.13318.71
5.4.200.0070.14716.79
5.4.190.0100.13318.75
5.4.180.0100.13718.70
5.4.170.0130.13318.75
5.4.160.0230.12718.71
5.4.150.0130.13018.59
5.4.140.0070.13716.30
5.4.130.0100.13016.25
5.4.120.0100.13016.18
5.4.110.0070.13316.25
5.4.100.0170.12716.40
5.4.90.0230.12016.27
5.4.80.0130.12316.18
5.4.70.0170.13016.39
5.4.60.0130.12716.27
5.4.50.0070.15016.26
5.4.40.0100.15016.19
5.4.30.0070.13716.28
5.4.20.0130.13716.20
5.4.10.0070.13316.28
5.4.00.0070.14315.88
5.3.290.0130.13014.71
5.3.280.0200.12314.64
5.3.270.0200.12714.61
5.3.260.0070.17314.83
5.3.250.0130.14714.74
5.3.240.0130.15314.64
5.3.230.0130.14014.68
5.3.220.0100.14314.59
5.3.210.0100.13314.63
5.3.200.0130.13714.71
5.3.190.0100.13314.67
5.3.180.0130.14014.67
5.3.170.0070.14014.68
5.3.160.0000.13714.74
5.3.150.0100.13014.67
5.3.140.0070.13714.67
5.3.130.0000.15014.74
5.3.120.0100.13714.61
5.3.110.0000.15714.54
5.3.100.0130.14014.10
5.3.90.0230.13714.08
5.3.80.0100.13014.08
5.3.70.0030.14714.13
5.3.60.0000.14014.05
5.3.50.0070.13014.08
5.3.40.0200.12314.02
5.3.30.0030.13714.14
5.3.20.0030.13713.80
5.3.10.0130.13713.70
5.3.00.0070.16713.66
5.2.170.0070.06311.25
5.2.160.0070.06011.37
5.2.150.0100.05711.18
5.2.140.0000.05011.16
5.2.130.0100.03711.32
5.2.120.0070.04311.30
5.2.110.0100.05011.30
5.2.100.0000.06011.23
5.2.90.0100.05011.21
5.2.80.0100.04011.32
5.2.70.0100.04011.17
5.2.60.0100.04011.03
5.2.50.0030.05011.11
5.2.40.0100.04010.97
5.2.30.0000.04711.05
5.2.20.0100.03711.08
5.2.10.0100.05011.08
5.2.00.0200.04010.71
5.1.60.0070.03710.06
5.1.50.0170.03710.19
5.1.40.0000.04710.16
5.1.30.0030.04010.38
5.1.20.0030.04010.39
5.1.10.0100.03310.18
5.1.00.0070.04710.25
5.0.50.0100.0338.55
5.0.40.0000.0338.49
5.0.30.0070.0408.42
5.0.20.0030.0278.32
5.0.10.0030.0308.22
5.0.00.0030.0438.18
4.4.90.0000.0235.92
4.4.80.0030.0205.96
4.4.70.0030.0235.91
4.4.60.0000.0235.98
4.4.50.0070.0175.87
4.4.40.0000.0375.86
4.4.30.0000.0235.90
4.4.20.0000.0305.97
4.4.10.0070.0235.94
4.4.00.0030.0335.94
4.3.110.0070.0205.82
4.3.100.0030.0205.81
4.3.90.0000.0235.77
4.3.80.0030.0335.79
4.3.70.0030.0205.82
4.3.60.0030.0205.77
4.3.50.0000.0275.89
4.3.40.0000.0375.77
4.3.30.0070.0174.86
4.3.20.0000.0234.86
4.3.10.0000.0234.86
4.3.00.0130.02016.19

preferences:
40.37 ms | 400 KiB | 5 Q