Home >php教程 >php手册 >字符处理函数 strtok(string str,string arg)

字符处理函数 strtok(string str,string arg)

WBOY
WBOYOriginal
2016-06-21 09:07:19885browse

函数

今天用到一个函数,查了一下手册,给出了如下的说明:
<?php $string = "This is\tan example\nstring";$tok = strtok($string," \n\t");while ($tok) {    echo "Word=$tok<br>";    $tok = strtok(" \n\t");}?>
输出:
Word=This
Word=is
Word=an
Word=example
Word=string
这个函数还有自动存储位置的功能,能够在连续的切割字符串取得相应的值,相对于split(string arg)的值
保存在数组中,但其arg却可以是多个字符,而split只能一个字符!
 



Statement:
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