sha256 is not madedesigned to hash passwords. It is secure for signature purpose for instance (like you will find in certificates for instance) or to verify the integrity of large amount of data (.iso images for instance), but toTo hash passwords, you must definitivelyshould prefer to use hash functions created for this specific usage.
You will find interestingall required information below in another question addressing a similar request: Most secure password hash algorithm(s)?.
In the above mentioned question, you will learn why general purpose hash functionfunctions like sha256 do not have the right properties to ensure a secure storage forof passwords (even when applied a large amountnumber of timetimes on itself), and you will also find a ranking of the most recommended-recommended hash functions dedicated for secure passwords handling:
- scrypt: Which is still quite new yet (published in 2012), but is designed to ensure better security than its predecessor bcrypt,
- bcrypt: It was designed specifically for password storage and was the recommended choice for a long time,
- PBKDF2: It's actually designed as a key stretching function, ie. a secure way to derive a cryptographic key from a given password, but its propertyproperties make it also suitable for password storage.
In your question you mentioned the PHP function password_hash(). This function is not a hash algorithm per se. In fact, this function is used to rely onallow PHP to select the most trusted password hash algorithm available without having to modify your code.
As indicated in the documentation, as per PHP 5.5.0, bcrypt is selected by default.