3v4l.org

run code in 300+ PHP versions simultaneously
<?php function createPasswordHash($strPassword, $numAlgo = 1, $arrOptions = array()) { if (function_exists('password_hash1')) { // php >= 5.5 $hash = password_hash($strPassword, $numAlgo, $arrOptions); } else { $salt = mcrypt_create_iv(22, MCRYPT_DEV_URANDOM); $salt = base64_encode($salt); $salt = str_replace('+', '.', $salt); $hash = crypt($strPassword, '$2y$10$' . $salt . '$'); } return $hash; } function verifyPasswordHash($strPassword, $strHash) { if (function_exists('password_verify1')) { // php >= 5.5 $boolReturn = password_verify($strPassword, $strHash); } else { $strHash2 = crypt($strPassword, $strHash); $boolReturn = $strHash == $strHash2; } return $boolReturn; } $strHash = createPasswordHash("sunshine", PASSWORD_DEFAULT); echo $strHash . "<br>\n"; if (verifyPasswordHash('sunshine', $strHash)) { echo 'Password is valid!'; } else { echo 'Invalid 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)
7.3.100.0070.00714.64
7.3.90.0100.00514.81
7.3.80.0080.00514.62
7.3.70.0040.01214.64
7.3.60.0140.00014.69
7.3.50.0130.00014.68
7.3.40.0030.01114.68
7.3.30.0050.00814.62
7.3.20.0620.00714.85
7.3.10.0750.00014.79
7.3.00.0530.00714.68
7.2.220.0070.00714.79
7.2.210.0060.00914.84
7.2.200.0060.00914.90
7.2.190.0160.00014.54
7.2.180.0100.00514.43
7.2.170.0090.00614.70
7.2.160.0050.00914.80
7.2.150.0410.01214.68
7.2.140.0350.00414.54
7.2.130.0510.01014.87
7.2.120.1560.00614.89
7.2.110.0430.00215.67
7.2.100.0980.01214.91
7.2.90.0430.00714.66
7.2.80.0320.00714.66
7.2.70.0410.00914.94
7.2.60.0620.00515.71
7.2.50.0990.00915.02
7.2.40.0600.01114.89
7.2.30.0150.01814.86
7.2.20.1750.01414.85
7.2.10.1210.00614.79
7.2.00.0330.00616.99
7.1.320.0380.00313.49
7.1.310.0450.01013.68
7.1.300.0690.01213.91
7.1.290.0520.00713.85
7.1.280.0560.00713.81
7.1.270.0330.01013.65
7.1.260.1100.00613.89
7.1.250.0750.00413.82
7.1.240.0220.00613.58
7.1.230.0720.00613.96
7.1.220.0510.01013.48
7.1.210.0550.00614.02
7.1.200.0280.00914.80
7.1.190.0270.00613.78
7.1.180.0820.01013.79
7.1.170.0480.01213.84
7.1.160.0770.01013.73
7.1.150.0370.00613.92
7.1.140.0970.00313.92
7.1.130.0850.00913.68
7.1.120.0580.00613.80
7.1.110.0550.00313.95
7.1.100.0210.01115.94
7.1.90.1040.00713.80
7.1.80.0430.00313.74
7.1.70.0310.01115.39
7.1.60.0330.00716.48
7.1.50.0120.01515.27
7.1.40.0320.00613.89
7.1.30.0540.00713.74
7.1.20.1300.00313.78
7.1.10.0430.01213.80
7.1.00.0270.04618.14
7.0.330.0530.01113.41
7.0.320.0480.00613.30
7.0.310.0410.00313.34
7.0.300.0290.01013.39
7.0.290.1430.00613.37
7.0.280.0580.00713.30
7.0.270.0470.01013.42
7.0.260.0290.01013.56
7.0.250.0510.00413.47
7.0.240.1280.01413.54
7.0.230.0420.00413.45
7.0.220.0430.00013.44
7.0.210.0230.00913.11
7.0.200.0360.00514.85
7.0.190.0730.00013.29
7.0.180.0520.00612.78
7.0.170.0820.01013.09
7.0.160.0170.00713.38
7.0.150.0640.00613.34
7.0.140.0330.03817.61
7.0.130.0540.01213.50
7.0.120.0450.00813.21
7.0.110.0170.01213.52
7.0.100.0580.00413.45
7.0.90.0200.00713.27
7.0.80.0300.00313.51
7.0.70.0550.00313.60
7.0.60.0240.04316.77
7.0.50.0320.09315.70
7.0.40.0180.09216.69
7.0.30.0530.10616.84
7.0.20.0410.10516.85
7.0.10.0340.11416.94
7.0.00.0280.11216.80
5.6.400.0120.00314.30
5.6.390.0060.00914.06
5.6.380.0060.01614.36
5.6.370.0120.00614.29
5.6.360.0130.00714.25
5.6.350.0030.01613.67
5.6.340.0060.00914.25
5.6.330.0100.00514.37
5.6.320.0670.01014.43
5.6.310.0110.00514.25
5.6.300.0090.00414.14
5.6.290.0050.00913.74
5.6.280.0110.03817.56
5.6.270.0290.01314.21
5.6.260.0130.00314.25
5.6.250.0040.00913.91
5.6.240.0070.01114.08
5.6.230.0040.01213.98
5.6.220.0110.00713.92
5.6.210.0150.02517.43
5.6.200.0070.08716.18
5.6.190.0080.11417.31
5.6.180.0180.09317.48
5.6.170.0160.09117.32
5.6.160.0030.08917.26
5.6.150.0050.11216.19
5.6.140.0060.09116.19
5.6.130.0100.08316.20
5.6.120.0090.11317.54
5.6.110.0050.11917.73
5.6.100.0090.10517.46
5.6.90.0120.11217.78
5.6.80.0090.10017.26
5.6.70.0140.00014.14
5.6.60.0080.01314.08
5.6.50.0110.00714.14
5.6.40.0390.00713.88
5.6.30.0020.01414.10
5.6.20.0050.01513.89
5.6.10.0110.00613.91
5.6.00.0080.01414.10
5.5.380.0150.00614.00
5.5.370.0050.00914.01
5.5.360.0080.00813.75
5.5.350.0480.04217.22
5.5.340.0090.10316.16
5.5.330.0080.11017.36
5.5.320.0150.08617.11
5.5.310.0170.11217.27
5.5.300.0040.08715.88
5.5.290.0030.11216.01
5.5.280.0040.08617.34
5.5.270.0400.09217.25
5.5.260.0110.11117.58
5.5.250.0050.08517.34
5.5.240.0050.11016.82
5.5.230.0090.00613.98
5.5.220.0050.01013.98
5.5.210.0080.01313.93
5.5.200.0600.01213.80
5.5.190.0050.00913.83
5.5.180.0680.00514.05
5.5.170.0080.01014.21
5.5.160.0480.01213.98
5.5.150.0150.00913.93
5.5.140.0220.00013.87
5.5.130.0000.01514.13
5.5.120.0080.00813.83
5.5.110.0030.01014.04
5.5.100.0060.00913.95
5.5.90.0210.00913.72
5.5.80.0350.00713.89
5.5.70.0070.00714.23
5.5.60.0170.00413.82
5.5.50.0070.00713.83
5.5.40.0790.01013.96
5.5.30.0170.00914.06
5.5.20.0170.00313.89
5.5.10.0160.00514.10
5.5.00.0300.01013.73
5.4.450.0190.11015.29
5.4.440.0100.08515.15
5.4.430.0130.08815.27
5.4.420.0070.09715.13
5.4.410.0120.08115.03
5.4.400.0170.10314.84
5.4.390.0170.10014.92
5.4.380.0260.08014.97
5.4.370.0120.08314.81
5.4.360.0280.08315.05
5.4.350.0120.08914.82
5.4.340.0250.08614.89
5.4.330.0120.00010.96
5.4.320.0150.08215.05
5.4.310.0110.08414.95
5.4.300.0150.08314.69
5.4.290.0210.08314.82
5.4.280.0670.08114.94
5.4.270.0420.08414.93
5.4.260.0230.07914.93
5.4.250.1040.08115.14
5.4.240.0130.08014.81
5.4.230.0120.08014.98
5.4.220.0110.10415.08
5.4.210.0170.10215.02
5.4.200.0140.09414.98
5.4.190.0180.11014.81
5.4.180.0220.10414.89
5.4.170.0220.08514.76
5.4.160.0160.09714.95
5.4.150.0180.08215.02
5.4.140.0100.08113.67
5.4.130.0140.07813.67
5.4.120.0320.07513.70
5.4.110.0150.07713.68
5.4.100.0270.09013.74
5.4.90.0130.11313.55
5.4.80.0120.08513.85
5.4.70.0180.10013.53
5.4.60.0240.08513.71
5.4.50.0150.08013.70
5.4.40.0150.08713.65
5.4.30.0130.09013.75
5.4.20.0160.08113.75
5.4.10.0600.10413.44
5.4.00.0160.10213.48
5.3.290.0150.02212.59
5.3.280.0130.02212.53
5.3.270.0180.02112.51
5.3.260.0170.03712.42
5.3.250.0340.02312.60
5.3.240.0150.02012.57
5.3.230.0110.02612.56
5.3.220.0190.01712.45
5.3.210.0140.02312.34
5.3.200.0410.02012.42
5.3.190.0070.02612.51
5.3.180.0140.02012.54
5.3.170.0180.03312.58
5.3.160.0380.02212.61
5.3.150.0160.01812.51
5.3.140.0220.02012.56
5.3.130.0150.04312.58
5.3.120.0200.02212.64
5.3.110.0180.01912.49
5.3.100.0090.02412.27
5.3.90.0100.03912.16
5.3.80.0120.03612.29
5.3.70.0120.02612.38
5.3.60.0150.03812.26
5.3.50.0340.03012.21
5.3.40.0120.04112.11
5.3.30.0120.02112.22
5.3.20.0340.03312.09
5.3.10.0360.02312.08
5.3.00.0130.03311.93

preferences:
37.41 ms | 401 KiB | 5 Q