字符串替换: echo substr_replace("abcdefg", "OK", 3)."";//abdOK echo substr_replace("abcdefg", "OK", 3,3)."";//abcOKg echo substr_replace("abcdefg", "OK", -2,3)."";//abcdeOK echo substr_replace("abcdefg", "OK", 3,-2)."";//abcOKfg echo substr_replace("abcdefg", "OK", 2,0)."";//abOKcdefg 编辑代码,并输出运行结果
举一反三
- 语句 echo substr_replace("abcdefg","kk",3,3)的运行结果是: A: abcdefdgkkk B: abckkg C: abkkfg D: kkkabcdefg
- $funName=”substr”;echo $funName(“abcdefg”,3);输出结果是()。 A: abc B: defg C: efg D: 程序报错
- 下面代码运行后输出的结果是( )。$str="phper";$replace="mysql";echo substr_replace($str,$replace,1,2); A: pmysqler B: phpermysql C: mysql D: pmysql
- 若串S1=‘ABCDEFG’, S2=‘9898’ ,S3=‘###’,S4=‘012345’,执行concat(replace(S1,substr(S1,4,3),S3),substr(S4,index(S2,‘8’),length(S2)))其结果为
- 该语句echo substr("Hello world",10)."<br>";打印结果为______(1)_______,该语句echo substr("Hello world",-10)."<br>";打印结果为______(2)_______,该语句echo substr("Hello world",-10,-2)."<br>";打印结果为____(3)________,