Function prototype: array split (string $ pattern, string $ string [, int $ limit])
The PHP split () function returns an array of strings. Each unit is $ string. The regular expression $ pattern is used as the substring separated by the boundary. If $ limit is set, the returned array can contain up to $ limit units. The last unit contains all the remaining parts of $ string. Spliti is a version that ignores the size of split. Code 6.8 is an example of a date that is frequently used.
PHP split () function code 6.8 date split
- <? Php
- $ Date = "08/30/2006 ";
- // The delimiter can be a diagonal line, a dot, or a horizontal line.
- List ($ month, $ day, $ year) = split
('[/.-]', $ Date );
- // The output is in another time format.
- Echo "Month: $ month; Day: $ day; Year:
$ Year <br/> n ";
- ?>
We hope that you can clearly understand the specific meaning of the PHP split () function through the code example above.