php基础-字符串处理
1.echo strlen("hello"); //取字符串的长度
2.echo strcmp("hello","hello"); //用来比较两个字符串是否相等,区分大小写
3.echo strcasecmp( ); //字符串比较,不区分大小写,相同返回0
4.echo strtolower("Hello"); //转小写
5.echo strtoupper("hello"); //转大写
6.$s="hello,world,test";
$arr=explode(",",$s); //将字符串s拆分,返回数组
7.$arr=array("111","222","333");
echo implode(",",$arr) //将数组元素拼接成字符串
8.$s="hello world";
echo substr_replace($s,"*",0,2); //截取替换,指定位置替换
9.$s="hello world";
echo str_replace("l","*",$s); //查找替换,ctrl+f也可以实现
10.$s="hello world";
echo substr($s,0,5); //截取字符串