Copy Code code as follows:
?
### Segmentation String # # # # #
function Jb51netcut ($start, $end, $file) {
$content =explode ($start, $file);
$content =explode ($end, $content [1]);
return $content [0];
}
?>
explode definitions and usage
The
explode () function splits the string into arrays.
Syntax
explode (separator,string,limit)
Parameters |
Description |
Separator |
Necessary. Specify where to split the string. |
String |
Necessary. The string to split. |
Limit |
Optional. Specify the maximum number of array elements to return. |
Description
This function returns an array of strings, each of which is a substring separated by separator as a boundary point.
The separator parameter cannot be an empty string. If separator is an empty string (""), Explode () returns FALSE. If the value contained in separator is not found in string, explode () returns an array that contains a single element in string.
If the limit parameter is set, the returned array contains up to limit elements, and the last element will contain the remainder of the string.
If the limit argument is a negative number, all elements except the last-limit element are returned. This feature is new in the PHP 5.1.0.
Tips and Comments
Note: The parameter limit is added in the PHP 4.0.1.
Note: Because of historical reasons, although implode () can receive two parameter order, but explode () not. You must ensure that the separator parameter is not preceded by a string parameter.
Example
in this case, we'll split the string into arrays:
Copy Code code as follows:
<?php
$STR = "Hello World". It ' s a beautiful day. ";
Print_r (Explode ("", $str));
?>
Output:
Array
(
[0] => Hello
[1] => world.
[2] => It ' s
[3] => a
[4] => beautiful
[5] => day.
)