1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| header("Content-type:text/html;charset=utf-8"); $str3 = <<<INFO hello world abc ok now INFO; echo $str3."<br />";
echo '\'\\ \n \t \v \$'."</br>"; echo "\'\\ \n \t \v \$ '' "."</br>"; echo '单引号只能转义\或\''; echo '双引号可以转义多字符,运行速度来说,单引号更快。另外,单引号不能输出变量值'."</br>"; $str1 = "liubei"; echo "老大是$str1"."<br />"; echo '老大是$str1'."<br />"; echo strlen('你好')."<br />"; echo mb_strlen('你好','utf-8')."<br />"; echo strpos('abcdefg', 'c')."<br />";
if(strpos('abcdefg','a') !== false){ echo '存在'."<br />"; }else{ echo '不存在'."<br />"; }
$str = 'fuck you'; echo str_replace('fuck', '萌萌', $str)."<br />";
$str ='男人,女人,男孩,女孩'; echo strtr($str, array('男'=>'女','女'=>'男'))."<br />";
$str = 'tommrow is another day'; echo substr($str, 0,3)."<br />"; echo substr($str, 0,-3)."<br />";
$str = 'tech,linux,mysql'; $arr = explode(',', $str); print_r($arr); echo "<br />";
$str = implode(',', $arr); echo $str; echo "<br />";
echo strtolower('abcdEFG')."<br />"; echo strtoupper('abcdEFG')."<br />";
|