字符串

    1.去除多余空格  trim()

    2.方便显示   nl2br()

    3.打印输出 printf("%.2f", $var); //输出到浏览器  sprintf() //返回格式化的浏览器

    4.大小写  strtoupper()  strtolower()  ucfirst()  ucwords()

    5.方便存储(问题字符 '' "" \ null)    addslashes()

    6.字符串数组  $arr = explode('@', $email);     implode($str);    strtok($str, ' ');

    7.substr($str, int start[, int length]);

    8.长度 strlen()

    9.字符串中查找  strstr()  strchr()  strrchr()  stristr()

    10.字符串替换  str_replace()

正则匹配

  1.字符集和类

    .  //除 \n 的任意字符    [a-z]  //a-z中的任意字符   [^a-z] //除a-z的任意字符

  2.重复

    ? //0-1  +  //1-  *  //0-   {n}  //n次  {n,} //至少n次  {m,n}  //m-n次

  3.子表达式

    (very ) //作为整体

  4.^ $

  5.|

正则匹配函数

  ereg('pattern', $str, $arr);//查找  ereg_replace('pattern', $replace, $str);//替换     split('pattern', $str);//分割