Home > Backend Development > PHP Tutorial > 常用字符串函数(二)_PHP

常用字符串函数(二)_PHP

WBOY
Release: 2016-06-01 12:32:10
Original
1158 people have browsed it




常用字符串函数(二)



 $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, ","));
?>


常用字符串函数

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template