wp_parse_list() – Cleans up an array, comma- or space-separated list of scalar values.

You appear to be a bot. Output may be restricted

Description

Converts a comma- or space-separated list of scalar values to an array.

Usage

$array = wp_parse_list( $list );

Parameters

$list
( array|string ) required – List of values.

Returns

array Array of values.

Source

File name: wordpress/wp-includes/functions.php
Lines:

1 to 7 of 7
function wp_parse_list( $list ) {
  if ( ! is_array( $list ) ) {
    return preg_split( '/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY );
  }

  return $list;
}
 

 View on GitHub View on Trac