explode
Splits a string by a delimiter and returns an array of strings.
Parameters
main.php
Return Values
array
Returns an array of strings created by splitting the string parameter
On success:Array containing the split strings
On failure:ValueError if separator is empty string
Notes
- If separator is not found in string, returns array containing the original string
- If limit is positive, returns maximum of limit elements
- If limit is negative, all elements except the last -limit are returned
- Function is binary-safe
Changelog
- 8.0.0: explode() throws ValueError if separator is empty string
Related Functions
parse_url
URLParses a URL and returns its components as an associative array or a specific component as a string.
parseurlcomponents
array_chunk
ArraySplits an array into chunks of specified size, returning a multidimensional indexed array with each chunk containing the specified number of elements.
splitchunkbatch