LaravelBook\Laravel4Powerpack\Form::select PHP Method

select() public method

Create a HTML select element.
public select ( string $name, array $options = [], string $selected = null, array $attributes = [] ) : string
$name string
$options array
$selected string
$attributes array
return string
    public function select($name, $options = array(), $selected = null, $attributes = array())
    {
        $attributes['id'] = $this->id($name, $attributes);
        $attributes['name'] = $name;
        $html = array();
        foreach ($options as $value => $display) {
            if (is_array($display)) {
                $html[] = $this->optgroup($display, $value, $selected);
            } else {
                $html[] = $this->option($value, $display, $selected);
            }
        }
        return '<select' . $this->html->attributes($attributes) . '>' . implode('', $html) . '</select>';
    }