After half a day of reading about the correct way to encode passwords, I am overwhelm and I've chosen to do it this way. However I'm not sure whether this is the best way to do it. Thanks in advance.
$password= "abc123";
$salt = mcrypt_create_iv(32, MCRYPT_RAND);
$this_will_be_stored_in_db= crypt($password,$salt);
echo $this_will_be_stored_in_db;