How to generate htpasswd compatible passwords with PHP

Sometimes we have to generate passwords in our code, no problem. But what about when you need to generate a password that is compatible with the htpasswd command, as in the password is the same as what would be generated by htpasswd? Well, if you are using PHP, you can use this function that I posted in the forums. Check it out …

Tell me what you are thinking?