3v4l.org

run code in 300+ PHP versions simultaneously
<?php $userId = '7788990011223344551'; $short_username = 'zerocool95'; $long_username = 'zerocool95-Y3Jhc2ggb3ZlcnJpZGUgaXMgcmVhbGx5IHplcm8gY29vbA'; $password = 'Mess with the best, die like the rest.'; echo "Using short username\n"; $combined = $userId . $short_username . $password; $hash = password_hash( $combined, PASSWORD_BCRYPT, [ 'cost' => 12 ] ); echo $hash . "\n"; if ( password_verify( $combined, $hash ) ) { echo "Correct user id, username, password combination\n"; } else { echo "Incorrect combination\n"; } $bad_combination = $userId . $short_username . 'not-my-password'; if ( password_verify( $bad_combination, $hash ) ) { echo "Correct user id, username, password combination\n"; } else { echo "Incorrect combination\n"; } // Output // $2y$12$OSlXjZirMYlaKtXqMTr1uePNIEEsxS4sDQHCpfg.vC/Aw9SBaEvBS // Correct user id, username, password combination // Incorrect combination echo "\n---\n"; // Now try it with the long, 52+ characters, username echo "Using LONG short username\n"; $combined = $userId . $long_username . $password; $hash = password_hash( $combined, PASSWORD_BCRYPT, [ 'cost' => 12 ] ); echo $hash . "\n"; if ( password_verify( $combined, $hash ) ) { echo "Correct user id, username, password combination\n"; } else { echo "Incorrect combination\n"; } $bad_combination = $userId . $long_username . 'not-my-password'; if ( password_verify( $bad_combination, $hash ) ) { echo "Correct user id, username, password combination\n"; } else { echo "Incorrect combination\n"; } // Output // $2y$12$p2xn6C0duRrnpjFQWTBCJe7hjlIq0GZHwmwRdAUgeOD30a5T85V/G // Correct user id, username, password combination // Correct user id, username, password combination

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.130.0211.22317.20
8.3.120.0231.22516.22
8.3.110.0271.21716.35
8.3.100.0231.19716.66
8.3.90.0231.22916.63
8.3.80.0401.20816.73
8.3.70.0201.19816.48
8.3.60.0271.23216.29
8.3.50.0271.20916.63
8.3.40.0301.19917.11
8.3.30.0131.20317.67
8.3.20.0271.24017.30
8.3.10.0171.22817.72
8.3.00.0001.20919.35
8.2.250.0271.20116.34
8.2.240.0371.21516.33
8.2.230.0131.23316.63
8.2.220.0171.19916.46
8.2.210.0301.22916.27
8.2.200.0201.20216.31
8.2.190.0071.20816.80
8.2.180.0171.20016.52
8.2.170.0271.23617.39
8.2.160.0131.24417.72
8.2.150.0261.20317.49
8.2.140.0331.23517.50
8.2.130.0071.21217.48
8.2.120.0131.20417.60
8.2.110.0431.22417.58
8.2.100.0331.22617.34
8.2.90.0131.20117.59
8.2.80.0331.21317.63
8.2.70.0171.20417.43
8.2.60.0231.22817.40
8.2.50.0171.23917.64
8.2.40.0201.22517.30
8.2.30.0301.21217.34
8.2.20.0331.19817.41
8.2.10.0131.20217.30
8.2.00.0101.20617.52
8.1.300.0101.25616.18
8.1.290.0171.23816.18
8.1.280.0131.20116.18
8.1.270.0401.21817.22
8.1.260.0231.19417.58
8.1.250.0301.22617.26
8.1.240.0301.22317.30
8.1.230.0301.23917.34
8.1.220.0131.20217.27
8.1.210.0201.21017.09
8.1.200.0231.19517.11
8.1.190.0101.20617.21
8.1.180.0201.23017.22
8.1.170.0131.24116.84
8.1.160.0201.20716.96
8.1.150.0271.22017.39
8.1.140.0101.20516.94
8.1.130.0131.20717.12
8.1.120.0131.20617.49
8.1.110.0171.19617.10
8.1.100.0331.21017.13
8.1.90.0071.20917.29
8.1.80.0131.25817.15
8.1.70.0361.21417.27
8.1.60.0331.23217.22
8.1.50.0071.19919.09
8.1.40.0131.23717.40
8.1.30.0031.20519.16
8.1.20.0101.25019.41
8.1.10.0131.23217.26
8.1.00.0071.20317.37

preferences:
28.18 ms | 403 KiB | 5 Q