The password_hash()
function added in PHP 5.5 is a wrapper for the crypt()
function.
Also, since it is compatible with existing password hashes, you should use this.
<?php
$password = crypt('secret text', generate_salt()); // PasswordHash: Use of `password_hash()` is encouraged.
<?php
$password = password_hash('secret text', PASSWORD_DEFAULT); // OK!