我们在学习1.PHP函数explode的格式如下:
array explode(string separator, string string,[int limit]);
2.参数中的separator为分隔符,string为待分割的字符串,limit为返回的数组中元素的最大个数。
PHP函数explode的具体使用实例:
- php
- $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
- ?>
- html>
- head>
- title>Test Explodetitle>
- head>
- body>
- php
- $peoples = file($DOCUMENT_ROOT.'/test/03/people.txt');
- $countcount = count($peoples);
- if ($count == 0) {
- echo 'NO peoples pending. Please try again later.';
- }
- for ($i = 0; $i $count; $i++) {
- $line = explode("t", $peoples[$i]);
- echo 'font color=red>'.$line[0].'font>';
- echo 'font color=blue>'.$line[1].'font>';
- echo 'font color=green>'.$line[2].'font>';
- echo 'br />';
- }
- ?>
- body>
- html>
希望广大学习爱好者们通过本文所介绍的PHP函数explode的使用示例,能够基本弄清PHP函数explode的使用方法。
已抢66712个
抢已抢38614个
抢已抢21316个
抢已抢2681个
抢已抢1548个
抢已抢19205个
抢