Automattic\WooCommerce\Admin\API\Reports\Customers
Controller::is_id_list
Check if a value is a comma-separated list of numeric IDs.
Method of the class: Controller{}
No Hooks.
Returns
bool. True if the value contains only numeric IDs.
Usage
$result = Controller::is_id_list( $value );
- $value(mixed) (required)
- The value to check.
Controller::is_id_list() Controller::is id list code WC 11.0.1
private static function is_id_list( $value ) {
if ( is_array( $value ) ) {
$values = $value;
} elseif ( is_string( $value ) ) {
$values = explode( ',', $value );
} else {
return false;
}
foreach ( $values as $v ) {
if ( ! is_numeric( trim( $v ) ) ) {
return false;
}
}
return true;
}