1.格式化输出 chop 是rtrim()的别名; ltrim() trim() nl2br()将/n转换成<br> print,echo,printf(),sprintf(): echo()不是函数,print()是函数,有返回值,boolen,false,true; printf()格式化输出
  --函数,把文字格式化以后输出,直接调用系统调用进行IO的,他是非缓冲的。如: $name="hunte"; $age=25; printf("my name is %s, age %d", $name, $age);
  sprintf()格式化字符串,然后赋给一个变量,但是不输出,类似于c了 <?php echo nl2br("foo isn't/n bar"); echo "foo isn't/n bar"; ?>
  --跟printf相似,但不打印,而是返回格式化后的文字,其他的与printf一样。如: char sql[256]; sprintf(sql,"select * from table where no = '%s'",bankno); 它的功能只是把""里面的语句赋给了变量sql。
  strtolower strtoupper ucwords ucfirst
  2.字符串的连接和分割 (1)array explode(string input ,string separator , int limit)
  使用一个字符串分割另一个字符串
  <?php // 示例 1 $pizza  = "piece1 piece2 piece3 piece4 piece5 piece6"; $pieces = explode(" ", $pizza); echo $pieces[0]; // piece1 echo $pieces[1]; // piece2
  // 示例 2 $data = "foo:*:1023:1000::/home/foo:/bin/sh"; list($user, $pass, $uid, $gid, $gecos, $home, $shell) = explode(":", $data); echo $user; // foo echo $pass; // *
  ?>   
  例子 2. limit 参数示例
  <?php $str = 'one|two|three|four';
  // 正数的 limit print_r(explode('|', $str, 2));
  // 负数的 limit print_r(explode('|', $str, -1)); ?>   
  string strtok( string input ,string separator)
  <?php $string = "This is/tan example/nstring"; /* Use tab and newline as tokenizing characters as well          */ $tok = strtok($string, " /n/t");
  //拿着空格,/n,/t作为令牌分割字符串
  while ($tok !== false) {             echo "Word=$tok<br />";             $tok = strtok(" /n/t"); } ?>
  结果:
  Word=This Word=is Word=an Word=example Word=string
  |