字符串
1 <?php 2 #取得字符串中个某个字符 3 #{}可以区分是字符串索引和数组索引 4 $str = 'Take me to your heart. Take me to your soul.'; 5 echo $str[3]; 6 echo $str{3}; 7 8 #查找子字符串 找到返回其实位置的数值下标,否则返回false 9 echo strpos($str,'@'); 10 11 #提取子字符串 12 echo substr($str,0,5); 13 14 #替换子字符串 15 echo substr_replace($str,'god',11); 16 17 #翻转字符串的顺序 18 echo strrev($str) 19 ?>