wc_string_to_array( string $string, string $delimiter = ',' )

Explode a string into an array by $delimiter and remove empty values.


Description Description


Parameters Parameters

$string

(Required) String to convert.

$delimiter

(Optional) Delimiter, defaults to ','.

Default value: ','


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/wc-formatting-functions.php

function wc_string_to_array( $string, $delimiter = ',' ) {
	return is_array( $string ) ? $string : array_filter( explode( $delimiter, $string ) );
}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.