Conditional Custom field with foreach

Less code lines with get_post_custom_values()

$values = get_post_custom_values('slider_id', $post_id);

// if non-empty
if($values) {
    foreach($values as $value)
        echo get_new_royalslider($value);
}

If $values array is empty, nothing happens.