public static function select($name, array $options, $selected = NULL, array $attributes = NULL)
    {
        $h = '';
        foreach ($options as $k => $v) {
            $a = array('value' => $k);

            // Is this element one of the selected options?
            if ($selected AND in_array($k, (array)$selected)) {
                $a['selected'] = 'selected';
            }

            $h .= self::tag('option', $v, $a);
        }

        if (!$attributes) {
            $attributes = array();
        }

        return self::tag('select', $h, $attributes + array('name' => $name));
    }
public static function select($name, array $options, $selected = NULL, array $attributes = NULL)
    {
        $h = '';
        foreach ($options as $k => $v) {
            $a = array('value' => $k);

            // Is this element one of the selected options?
            if ($selected AND in_array($k, (array)$selected)) {
                $a['selected'] = 'selected';
            }

            $h .= self::tag('option', $v, $a);
        }

        if (!$attributes) {
            $attributes = array();
        }

        return self::tag('select', $h, $attributes + array('name' => $name));
    }
public static function select ( $ name , array $ options , $ selected = NULL , array $ attributes = NULL ) { $ h = '' ; foreach ( $ options as $ k => $ v ) { $ a = array ( 'value' => $ k ) ; // Is this element one of the selected options? if ( $ selected AND in_array ( $ k , ( array ) $ selected ) ) { $ a [ 'selected' ] = 'selected' ; } $ h .= self :: tag ( 'option' , $ v , $ a ) ; } if ( ! $ attributes ) { $ attributes = array ( ) ; } return self :: tag ( 'select' , $ h , $ attributes + array ( 'name' => $ name ) ) ; }
Auto creates a form select dropdown from the options given .

@param string $name the select element name
@param array $options the select options
@param mixed $selected the selected options(s)
@param array $attributes of additional tag settings
@return string
Auto creates a form select dropdown from the options given .