Is this password hashing function safe? Would this be secure enough to hash passwords? 

/**
 * Creates a SHA-256 hash
 * @param  string $salt Salt for hashing algorithm
 * @param  string $string What is getting hashed
 * @return string Returns a hashed string
 */
public function hash ($string, $salt) {
    $crypt = crypt($string, '$5$rounds=5000$' . $salt . '$');
    $hash = str_replace('$5$rounds=5000$' . $salt . '$', '', $crypt);

    return $hash;
}
Using SHA-256 with a salt is not that bad. But PHP has built in functions like password_hash and password_verify to hash passwords. It uses bcrypt, which is currently one of the best methods to hash passwords these days. I would recommend this approach and it is just as easy to use like the function you've written.