我正在尝试用星号替换给定字符串的所有字母,减去第一个字母。我试过这个:
$AnswerArr = str_split($Answer);
$AnswerCount = count($Answer);
$Toreplace = $AnswerCount - 1;
$ReplaceAnswer = str_replace($AswerArr['0'], "*", $Answer, $Toreplace);
但这不起作用,我必须使用正则表达式吗?
使用提供的第一个答案:
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