<?php $a = " n001|n002|n003|n004 ";
//echo strlen($a);//取字符串的长度
//var_dump(strcmp("hello","Hello"));//判断两个字符串是否相同,相同返回0,不同返回1,区分大小写
//echo strcasecmp("hello","Hello"); //判断两个字符串是否相同相同返回0,不同返回1,不区分大小写 //echo strtolower($a);//转小写
//echo strtoupper($a);//转大写 //$attr = explode("|",$a); //拆分字符串,返回一个数组
//echo implode(">",$attr); //将数组元素拼接成字符串 //echo substr_replace($a,"mm",0,4);//替换字符串,替换指定位置
//echo str_replace("n","p",$a); //查找替换 /*$str = array(
array("n001","汉族"),
array("n002","回族"),
array("n003","苗族")
); $a = "n001^汉族|n002^回族|n003^苗族|"; echo substr($a,0,strlen($a)-1); //截取字符串
*/ //var_dump(str_split($a,2));//根据长度拆分字符串 //echo strstr($a,"|");//返回某个字符串出现的位置到末尾的全部字符 //echo trim($a);//去空格 //$a.trim();//JS没有,但是Jquery有 ?>