這些可都是辛辛苦苦敲出來的記得多回頭來看看啊一定!!!
/*echo <<< mark
qqqqqq\nqqqqqq<br>qqqqqqqqqqqqq\rqqqqqqqqqqqqqqqqqq
mark*/
//技術標志要另起一行,並且是頂格寫!
//作用跟""類似
//最致命的一點是:mark後面不能有任何符號,就是它必須用在代碼的最後部分
$a = "aaaaaaaaaa";
$b = "bbbbbbbbbb";
$c = print($a);
echo "<br>";
echo $c;
echo "<br>";
echo $a,$b;
//5b二進制格式;%c ASCII格式
$format = "%b,%c";
printf($format,100,200);
echo sprintf($format,100,200);
echo "<br>";
$str = "abcdefghijklmnopqrstyvwxyz";
$width = 4;
$break = "\t";
echo wordwrap($str,$width,$break,true);
/*strtoupper();
strtolower();
ucwords();*/
//strlen()
//字符串中的空格也算一個啊
//substr_count(string str,string sub,[int start,int length])的使用
$words = "ran zhang li ni ran ran";
$handle = "ran";
$count = substr_count($words,$handle);
echo $count;
//mixed str_word_count(string $str,[int format,string $child]);
//format 0:默認值,返回單詞數目
// 1:返回單詞的數組,鍵是索引值
// 2:返回單詞的數組,鍵是單詞首字母的位置
//查找子串
$a1 = "aaaaaabdddddd";
$a2 = "b";
$a3 = strstr($a1,$a2);
echo $a3;
//輸出bdddddd
//位置查找,跟上面的幾乎一樣就是返回的是位置
//int strpos(string $a,string b,[int offset]);
//字符串復制
echo "<br>";
$input = "zhangran";
$number = 10;
$str = str_repeat($input,$number);
echo $str;
//字符串的反轉
echo "<br>";
$a4 = strrev("abc");
echo $a4;
//替換
//substr_replace(mixed $string,string $replacement,int $start,[int $length])
//切分
echo "<br>";
$a5 = "hello,world,i,am,the,only,one";
$separator = ",";
$a7 = 3;
$array = explode($separator,$a5,$a7);
print_r($array);
echo "<br>";
$a8 = "qqqqqqqqqqqqqqqqqq";
$a9 = 4;
$b3 =str_split($a8,$a9);
print_r($b3);
//如果不能被整出的 先以前面的先
//合並
echo "<br>";
$b4 = array("aaa","bbb","ccc");
$b5 = ",";
echo implode($b5,$b4);
//字符串的比較
//int strcmp(str1,str2)這是完全比較
//strncmp(str1,str2,len)比較兩個字符串的前len個字符串是否相等
作者 kaituozhe345的專欄