S
S
shanik2018-02-20 15:02:46
PHP
shanik, 2018-02-20 15:02:46

How to output it correctly?

There is an array:
5a8c0e51e281d361696024.png
There are also other parameters in the array.
you need to get this look, i.e. for each parameter a table is built with its values:
5a8c0e6408a6c598003200.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
imhuman, 2018-02-20
@shanik

Well, if a separate table is being built for the parameter , then it would be more logical to group the data precisely on this basis, and building on them will no longer be any difficulty. Something like this

$data=[
  'name'=>'param1',
  'categories'=>[
    [
      'name'=>'category1',
      'value_1'=>'',
      'value_2'=>'',
    ],
  ],
];

A
Alexander, 2018-02-20
@AK-VoronM

echo "Тут заголовок, с разделителем \t", "\n";
foreach ($array as $arr) {
    echo $arr['name'], "\t", $arr['value_1'], "\t", $arr['value_2'], "\n";
}

The console will display what you need. For the browser, you need to draw a table, but the output loop will be the same.

N
Nikita, 2018-02-20
@Rema1ns

More or less like this

<table>
  <tr>
    <th>Параметры и групы</th>
    <th>Редкость</th>
    <th></th>
  </tr>
  <tr>
  <? foreach ($array as $row) {?>
    <td><?=$row['name']?></td>
    <td><?=$row['value_1']?></td>
    <td><?=$row['value_2']?></td>
  <?}?>
  </tr>
</table>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question