3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Note that the salt here is randomly generated. * Never use a static salt or one that is not randomly generated. * * For the VAST majority of use-cases, let password_hash generate the salt randomly for you */ $options = [ 'cost' => 11, 'salt' => mcrypt_create_iv(MCRYPT_CAST_256, MCRYPT_DEV_URANDOM), ]; echo password_hash("rasmuslerdorf", PASSWORD_BCRYPT, $options)."\n"; ?>
Output for 7.0.6 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.6
Fatal error: Uncaught Error: Call to undefined function mcrypt_create_iv() in /in/mCjJD:10 Stack trace: #0 {main} thrown in /in/mCjJD on line 10
Process exited with code 255.
Output for 7.0.0 - 7.0.5
Warning: mcrypt_create_iv() expects parameter 1 to be integer, string given in /in/mCjJD on line 10 Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in /in/mCjJD on line 12 Warning: password_hash(): Non-string salt parameter supplied in /in/mCjJD on line 12
Output for 5.5.35, 5.6.21
Fatal error: Call to undefined function mcrypt_create_iv() in /in/mCjJD on line 10
Process exited with code 255.
Output for 5.5.24 - 5.5.34, 5.6.7 - 5.6.20
Warning: mcrypt_create_iv() expects parameter 1 to be long, string given in /in/mCjJD on line 10 Warning: password_hash(): Non-string salt parameter supplied in /in/mCjJD on line 12
Output for 5.4.2 - 5.4.45
Warning: mcrypt_create_iv() expects parameter 1 to be long, string given in /in/mCjJD on line 10 Fatal error: Call to undefined function password_hash() in /in/mCjJD on line 12
Process exited with code 255.

preferences:
95.68 ms | 401 KiB | 91 Q