L
L
Leopandro2016-02-22 13:46:43
Yii
Leopandro, 2016-02-22 13:46:43

What happened to foreach?

foreach ($products as $product)
        {
            $newProduct = $productForm; //Берем форму продукта
            foreach($newProduct as $column)
            {
                $value = $product[$column['name']]; //тут беру значение продукта по имени колонки
                $column['value'] = $value; //Заполняем значение
            }
            $resultArr[] = $newProduct; // Получаем массив с незаполненными значениями
        }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikita, 2016-02-22
@bitver

Well, as it were, everything is correctly written in the comments, what is the actual question?

D
Dmitry, 2016-02-22
@kasus

foreach ($products as $product)
{
  $result = array();
  foreach($productForm as $column)
  {
    $result[] = array(
      'name' => $column['name'],
      'value' => $product[$column['name']]
    );
  }
  $resultArr[] = $result;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question