/**
 * Return Strings object as array based on a delimiter.
 *
 * @param string $delimiter Delimeter. Default is null.
 *
 * @return array Return Strings object as array based on a delimiter.
 */
public function toArray(?string $delimiter = null): array

Examples

$array1 = Strings::create('hello world')->toArray();
$array2 = Strings::create('hello, world')->toArray(',');

print_r($array1);

print_r($array2);

The above example will output:

Array
(
    [0] => hello world
)

Array
(
    [0] => hello
    [1] => world
)

Getting Started

Methods