Split
(PHP3, PHP4)
Split---&http://www.aliyun.com/zixun/aggregation/37954.html ">NBSP; To cut a string in a regular expression
Syntax: Array split (string pattern, string string [, int limit])
Description:
Returns an array of strings, using regular expression pattern as the boundary, and cutting string strings. If there is a set limit, the returned array will contain a maximum of limit elements, and the last element will contain the remaining portion of all strings. If an error occurs, split () returns FALSE.
The following examples can be obtained from the passwd line with five field data:
<?php
$passwd _list = Split (":", $passwd _line, 5);
?>
You can use a slash, a comma, or a hyphen to parse the date:
<?php
Date = "04/30/1973"; Delimiters may be slash, dot, or hyphen
List ($month, $day, $year) = Split (' [/.-] ', $date);
echo "Month: $month; Day: $day; Year: $year <br>\n ";
?>
Note: pattern is case-sensitive
Note: If you do not need formal expressive functions, you can use faster explode ()
Reference: Spliti () explode () implode ()