WordPress at a glance

wp_parse_id_list() WP 1.0

Clean up an array, comma- or space-separated list of IDs.

✈ 1 time = 0.000044s = very fast | 50000 times = 0.53s = very fast

No Hooks.

Return

Array. Sanitized array of IDs.

Usage

wp_parse_id_list( $list );
$list(array/string) (required)
List of ids.

Code of wp_parse_id_list: wp-includes/functions.php VER 4.9.8

<?php
function wp_parse_id_list( $list ) {
	if ( !is_array($list) )
		$list = preg_split('/[\s,]+/', $list);

	return array_unique(array_map('absint', $list));
}

Related Functions

From category: Helper Functions

No comments
    Hello, !     Log In . Register