<?php
/**
 * @var $name
 * @var $arr_values
 * @var $multiple_attr
 * @var $other_atts
 * @var $arr
 * @var $opts
 * @var $multiple
 * @var $default
 */
?>

<select class="ui dropdown" name="<?php echo $name . $arr_values; ?>" <?php echo $multiple_attr; ?> id="<?php echo $name; ?>" <?php echo $other_atts; ?>>

	<?php foreach ( $arr as $key => $value ) {

		if ( is_array( $opts ) ) {
			$selected = in_array( $key, $opts ) ? "selected='selected'" : " ";

		} elseif ( ! $multiple && $opts !== false ) {
			$selected = $opts == $key ? "selected='selected'" : " ";

		} else {
			$selected = $key == $default ? "selected='selected'" : " ";

		} ?>

		<option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value; ?></option>

	<?php } ?>

</select>