PHP Code: 
    public function saltGenerator($limitChars=8) {
        
$symb "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()-=_+[]{}\\|;:'\",./<>?~`";//letters,numbers,& symbols
        
$saltv '';
        for (
$i 0$i $limitChars$i++)
            
$saltv .= $symb[rand(0strlen($symb) - 1)];
        return 
$saltv;
    } 
well this is pretty small but its a mini function to generate salt hash value(s) to make secure when inserted in the database for either when a user registers or w/e which then when you want use of the function for making the pass-hash you can do something like this:
PHP Code: 
$saltv $saltv ?: $this->saltGenerator();
$phash md5(md5($saltv) . md5($pass));
$sql->password $phash;
$sql->salt $saltv
This is really something that can be used in a class to make things easier. Did this off the top of my head so if there is room for improvement let me know