日期:2014-05-17 浏览次数:20582 次
file:str-lengh.php url:http://localhost:88/str/str-lengh.php <?php $word = 'Hello, Ryan!'; echo "String($word)'s length: ".strlen($word)."<br/>"; // for循环访问数组 //for($i=0; $i<strlen($word); $i++){ // echo $word[$i],"<br/>"; //} // while循环访问数组 $i=0; while($i<strlen($word)){ echo $word[$i],"<br/>"; $i++ } ?>
file:str-strip-tags.php url:http://localhost:88/str/str-strip-tags.php <?php // 字符串中的所有html标签都闭合 $text = "<h1>hello world!</h1><h1>hello world!</h1><h1>hello world!</h1>"; // 输出原始的字符串内容 echo "Original Text:"; echo $text."<br/>"; // 去除所有html标签后进行输出 echo "Destination Text(After strip_tags)"."<br/>"; echo strip_tags($text)."<br/>"; // 字符串中的html标签不闭合 $text = "<h1>hello world!"; // 去除所有html标签后进行输出 echo "Original Text:"; echo $text."<br/>"; // 去除所有html标签后进行输出 echo "Destination Text(After strip_tags)"."<br/>"; echo strip_tags($text)."<br/>"; ?>
file:str-entities.php url:http://localhost:88/str/str-entities.php <?php $text = "hello & world!"; echo $text."<br/>"; echo rawurlencode($text)."<br/>"; ?>
file:str-wordwrap.php url:http://localhost:88/str/str-wordwrap.php <?php $text = "This document covers the JavaTM 2 Platform Standard Edition 5.0 Development Kit (JDK 5.0). Its external version number is 5.0 and internal version number is 1.5.0. For information on a feature of the JDK, click on its component in the diagram below."; echo "Original text:"."<br/>"; echo $text."<br/>"; echo $text."<hr/>"; echo "Destination text(after wrap):"."<br/>"; echo wordwrap($text, 50, "<br/>")."<br/>"; ?>
file:str-strpos.php url:http://localhost:88/str/str-strpos.php <?php $text = "hello world!"; echo strpos($text, "e"); ?>
file:str-strreplace.php url:http://localhost:88/str/str-strreplace.php <?php $text = "This document covers the JavaTM 2 Platform Standard Edition 5.0 Development Kit (JDK 5.0). Its external version number is 5.0 and internal version number is 1.5.0. For information on a feature of the JDK, click on its component in the diagram below."; echo