Hello List,
Hope your all ready for the Holidays, I know I am. :)
I have a situation where I want to display a users password as bullets instead of the actual password characters once read from the database. I feel there is a better way than what I am doing. I am trying str_replace() with a for loop to loop throuth how many characters and replace each with a bullet when displaying.

Like this:
$replace_count = strlen($UserPassword);

for ($i=0; $i < strlen($UserPassword); $i++) {
$UserPassword = str_replace('a', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('b', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('c', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('d', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('e', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('f', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('g', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('h', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('i', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('j', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('k', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('l', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('m', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('n', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('o', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('p', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('q', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('r', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('s', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('t', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('u', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('v', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('w', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('x', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('y', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('z', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('1', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('2', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('3', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('4', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('5', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('6', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('7', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('8', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('9', '&#8226;', $UserPassword, & $replace_count); $UserPassword .= str_replace('0', '&#8226;', $UserPassword, & $replace_count);
} //hide pasword

But I keep getting a paramiters error for str_replace.

Warning: Wrong parameter count for str_replace() in blah, blah, blah

Doesn't strlen return a number value?

Thanks in advance.

Karl DeSaulniers
Design Drumm
http://designdrumm.com

Reply via email to