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
Output for git.master
Using short username $2y$12$dHPjKtF6Z4pg4oJvlOdmrumR2VF87Ph8j0.8Mz1tlIKV4OWe.GN0y Correct user id, username, password combination Incorrect combination --- Using LONG short username $2y$12$hNoMV9HLwMtO.tYqOHPCPOVbHN9gjFA7gFHJQ42.EUeQs1vtCWghK Correct user id, username, password combination Correct user id, username, password combination
Output for git.master_jit
Using short username $2y$12$UBtxrPcekaXE.3IftsaibOug8Ozg5OT7eGXvlm6Z9FycDV72fK0Ie Correct user id, username, password combination Incorrect combination --- Using LONG short username $2y$12$n4EfupBResFQFKdf2MHeZOZozP3MY0qx.rWOpxonIAamqQDzHm0sG Correct user id, username, password combination Correct user id, username, password combination

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
24.55 ms | 407 KiB | 5 Q