yii2 add option group label in dropdown list
<p>This is my <code>dropdownlist</code> like..</p>

<pre><code>&lt;?= $form-&gt;field($queModel, 'qm_category_id')-&gt;dropdownList(QuestionCategory::getQuestionCat()) ?&gt;
</code></pre>

<p>This is <code>getQuestionCat()</code> function</p>

<pre><code>public static function getQuestionCat()
{
    $dataTmp = self::find()-&gt;all();
    $result = yii\helpers\ArrayHelper::map($dataTmp, 'qc_id', 'qc_name', 'qcCourse.course_name');
    print_r($result); exit;
    return $result;
}
</code></pre>

<p>Above function return this array using ArrayHelper</p>

<p><a href="https://i.stack.imgur.com/ez8B7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ez8B7.png" alt="enter image description here"></a></p>

<p>show below image like..</p>

<p><a href="https://i.stack.imgur.com/Pd5sT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Pd5sT.png" alt="enter image description here"></a></p>

<p>In this dropdownlist the first <code>&lt;optgroup label=""&gt;</code> set to <code>&lt;optgroup label="Other"&gt;</code></p>