龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > php编程 >

php使用strtok方法拆分字符串

时间:2014-06-23 02:51来源:网络整理 作者:网络 点击:
分享到:
php使用strtok方法拆分字符串 [代码片段(25行)]
<?php
<html>
<head>
<title>Dividing a string into tokens with strtok()</title>
</head>
<body>
<div>
<?php
$test = 'php?id=353&sec=44&user=harry&context=php';

$delims = '?&';
$word = strtok( $test, $delims );
while ( is_string( $word ) ) {
 if ( $word ) {
   print '$word<br/>';
 }
 $word = strtok( $delims );
}
?>
</div>
</body>
</html>

精彩图集

赞助商链接