AI编程助手
AI免费问答

常用字符串函数(二)_PHP

  2016-06-01 12:32   1265浏览 原创




常用字符串函数(二)



 $text = "My dog's name is Angus.";
 //print Angus
 print(substr($text, 17, 5)."
");//取出子串
?>

 //切开字串
 // 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
\n");
 }
?>

 //传回字串中某字串开始处至结束的字串
 $text = "Although this is string, it's not very long.";
 print("


".strstr($text, ","));
?>


常用字符串函数

php免费学习视频:立即学习
踏上前端学习之旅,开启通往精通之路!从前端基础到项目实战,循序渐进,一步一个脚印,迈向巅峰!

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。