if you alltime wants to show 1st and last 3 letters and in between some * than you can do it by sub-string and string concat method
$str = "hello this is my password";
echo substr($str,0,3)."******".substr($str,(strlen($str))-3,3);
1
solved How can I hide/replace a part of a string in PHP? [duplicate]