Answers:
您可以使用该substr
函数返回从第5个字符开始的子字符串:
$str = "The quick brown fox jumps over the lazy dog."
$str2 = substr($str, 4); // "quick brown fox jumps over the lazy dog."
function String2Stars($string='',$first=0,$last=0,$rep='*'){
$begin = substr($string,0,$first);
$middle = str_repeat($rep,strlen(substr($string,$first,$last)));
$end = substr($string,$last);
$stars = $begin.$middle.$end;
return $stars;
}
例
$string = 'abcdefghijklmnopqrstuvwxyz';
echo String2Stars($string,5,-5); // abcde****************vwxyz
$num = "+918883967576";
$str = substr($num, 3);
echo $str;
输出:8883967576
您可以通过带有substr函数的php函数使用它
<?php
function removeChar($value) {
$value2 = substr($value, 4);
return $value2;
}
echo removeChar("Dummy Text. Sample Text.");
?>
您得到以下结果:“ y文本。示例文本。 ”
使用php的内置substr函数...
$result = substr($string, $startFromCharacter, $characterCountToRemove);
$result = substr("Hello World", 0, 5);
//will return World
s($str)->cutStart(4)
如在该独立库中所发现的,您可能会发现有帮助。这是多字节或Unicode安全的。