If you can wait til php 5.5, there will be some helpful functions for this built in:
https://gist.github.com/3707231
Till then, use crypt - you could look at this forward compatible port of the new functions:
https://github.com/ircmaxell/password_compat