标题常用字符串函数(二)
日期:2008-01-22    作者:semirock   来源:444p.com
文章打印自: PHP学习之家
访问文章完全地址: http://www.444p.com/example/php-example/aid2007/
头部广告
常用字符串函数(二)


<HTML>
<HEAD>
<TITLE>常用字符串函数(二)</TITLE>
</HEAD>
<BODY>
<?
 $text = "My dog's name is Angus.";
 //print Angus
 print(substr($text, 17, 5)."<hr>");//取出子串
?>
<?
 //切开字串
 // create a demo string
 $line = "leon\tatkinson\tleon@clearink.com";

 // loop while there are still tokens
 for($token = strtok($line, "\t");
  $token != "";
  $token = strtok("\t"))
 {
  print("token: $token<BR>\n");
 }
?>
<?
 //传回字串中某字串开始处至结束的字串
 $text = "Although this is string, it's not very long.";
 print("<hr>".strstr($text, ","));
?>
</BODY>
</HTML>



责任编辑:semirock