After a few days reading up about salting and hashing passwords, I found an actual bit of code that tells how to do it. This is what I found:
$blowfish_salt = bin2hex(openssl_random_pseudo_bytes(22));
$hash = crypt($data, "$2a$12$".$blowfish_salt);
Is this a good way to do it?