Skip to content

string_explode

Hyomoto edited this page Jun 13, 2021 · 6 revisions
Jump To Go Back Arguments

string_explode( string, divider, *trim )

Returns: array

Throws: InvalidArgumentType

Breaks the input string up based on divider and returns the results as an array. If trim is true, whitespace will also be trimmed from each element. If a non-string is provided for string or divider, or a non-number for trim, InvalidArgumentType will be thrown.

string_explode( "cat, bat, rat, hat", "," );
Output: [ "cat","bat","rat","hat" ]

Arguments

Name Type Purpose
string string The string to explode
divider string The character(s) to use to break up the string
*trim bool optional: Whether to trim whitespace from each item
Clone this wiki locally