Пример #6 Доступ к элементам массива<?php $array = array( "foo" => "bar", 42 => 24, "multi" => array( "dimensional" => array( "array" => "foo" ) ) ); var_dump($array["foo"]); var_dump($array[42]); var_dump($array["multi"]["dimensional"]["array"]); ?>
public function actionStat()
{
$mass1 = Category::find()->asArray()->all();
$mass2= Price::find()->asArray()->all();
return $this->render('stat' , compact('mass1', 'mass2'));
}
<?php foreach ($mass1 as $item) :?>
<ul class="treeview">
<?php if ($item['id'] != 17): ?>
<li><a href="#"><?=$item['name']?> - 3</a>
<ul>
<?php foreach ($mass2 as $itemok) :?>
<?php if ($item['id'] == $itemok['category_id']): ?>
<li><a href="#"><?=$itemok['name']?></a></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</li>
<?php endif; ?>
</ul>
<?php endforeach; ?>