批改状态:合格
老师批语:应该练习一些咱们课堂上没讲的函数就好了
$arr=['name'=>'王壮','age'=>18,'sex'=>'man'];echo implode(',',$arr);
$str='王壮,18,man';print_r(explode(',',$str,1));
//echo substr($str,1,5);
echo substr_count('This is a test', 'is', 3, 3);
$str='我的天 今天罗志祥真火';$replace='天';echo substr_replace($str,$replace,1,3);//如果是是个数组要被替换就可以换键数组的字符的某几个$res = substr_replace(['id:101', 'id:203', 'id:908'], '0', 3, 1);print_r($res);echo '<hr>';// echo implode('; ', $res), '<br>';//可以换相对应的写入要替换的值并替换$res = substr_replace(['id:101', 'id:203', 'id:908'], ['a', 'b', 'c'], 3);echo implode('; ', $res), '<br>';//可以换数组的时候 相对应的换长度$res = substr_replace(['id:101', 'id:203', 'id:908'], ['a', 'b', 'c'], 3, [1,2,3]);echo implode('; ', $res),'<br>';
$str='abc,bcd,cde';print_r(str_split($str,2));
echo str_pad('abc',10,'=',STR_PAD_LEFT);
$str='123';echo str_repeat($str,14);
$str='13848934497';echo str_replace('4893','****',$str,$count);echo '<hr>';echo $count;
$str=' 123 ';echo strlen($str);echo strlen(trim($str));echo strlen(rtrim($str));echo strlen(ltrim($str));
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号