$options = [ ['value' => '1', 'label' => 'Option 1'], ['value' => '2', 'label' => 'Option 2'], ['value' => '3', 'label' => 'Option 3'], ]; echo yii\helpers\Html::renderSelectOptions($options, '2');
$options = [ ['value' => 'USA', 'label' => 'United States'], ['value' => 'CAN', 'label' => 'Canada'], ['value' => 'MEX', 'label' => 'Mexico'], ]; echo yii\helpers\Html::renderSelectOptions($options, 'MEX');This will output the HTML code for a select dropdown menu with three options, where the third option (Mexico) is pre-selected. This function is part of the Yii Framework's `yii\helpers` package.