I am trying to replace all Letters of a given string with an asterisk, minus the first letter. I have tried this:
$AnswerArr = str_split($Answer);
$AnswerCount = count($Answer);
$Toreplace = $AnswerCount - 1;
$ReplaceAnswer = str_replace($AswerArr['0'], "*", $Answer, $Toreplace);
But this does not work, Do I have to use a regular expression?
Using the first answer provided :
Warning: substr() expects parameter 1 to be string, array given in /var/www/New/API/FormValidation.php on line 15
Warning: strlen() expects parameter 1 to be string, array given in /var/www/New/API/FormValidation.php on line 15
Warning: str_repeat() [function.str-repeat]: Second argument has to be greater than or equal to 0 in /var/www/New/API/FormValidation.php on line 15
This should work.