Hello. Faced a problem. I need to write data to an array, but when it runs, it overwrites it. How to make so that there added the data, but did not rewrite? To make my data look like [0] => arrray ([0] => name1 [1] => name2)
$dataCategories = $modelCategories::find()->select(['*'])->orderBy(['name' => SORT_DESC])->all(); $arrayCategories = []; foreach($dataCategories as $arrayDataCategories ){ $arrayCategories[] = [ $arrayDataCategories->id => $arrayDataCategories->name ]; } echo"<pre>"; var_dump($arrayCategories); exit;