Explain how to use the PHP function explode. Currently, the PHP function explode () separates strings into arrays. explode (separator, string, limit) separator is required. Specifies where to split the string. String is required. The string to be split. L currentlyPHP function explode () splits string into arrays
Explode (separator, string, limit)
Separator is required. Specifies where to split the string.
String is required. The string to be split.
Limit is optional. Specifies the maximum number of returned array elements.
Example of PHP function explode ()
-
- $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.
- )
The above code example is the specific use of the PHP function explode.
The export PHP function explode () splits the string into an array explode (separator, string, limit) separator. Specifies where to split the string. String is required. The string to be split. L...