A
A
Andrey Angelovich Stock2018-03-21 18:21:19
PHP
Andrey Angelovich Stock, 2018-03-21 18:21:19

Array keys to table in turn?

Hi all! There is an array:

Array ( [https://www.utkonos.ru/item/42/1096527] => 2 [https://proactions.ru/actions/food/makfa/] => 2 [https://www.utkonos.ru/item/42/1096519] => 2 [https://www.utkonos.ru/item/1381/3223485] => 2 [http://makfa.nichost.ru/] => 2 [https://ru.wikipedia.org/wikif/%D0%9C%D0%B0%D0%BA%D1%84%D0%B0] => 1 [http://ru.makfapasta.com/producftion/product/pasta/] => 1 [http://ru.mafkfapasta.com/] => 1 [https://www.utkonocs.ru/item/42/1096522] => 1 [https://www.makfa.rur/] => 1 [https://ru.wikipedia.org/wiki/%D0%9C%D0%B0%D0%BA%D1%84%D0%B0] => 1 [http://ru.makfapasta.com/production/product/pasta/] => 1 [https://www.utkonos.ru/item/42/1096522] => 1 [https://www.makfa.ru/] => 1 [http://ru.makfapasta.com/] => 1 )

Please tell me how to display links from this (i.e. keys) array into a table.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
riot26, 2018-03-21
@your_uncle

<?php
$a = [
  'https://www.utkonos.ru/item/42/1096527' => 2,
  'https://proactions.ru/actions/food/makfa/' => 2,
  'https://www.utkonos.ru/item/42/1096519' => 2,
  'https://www.utkonos.ru/item/1381/3223485' => 2,
  'http://makfa.nichost.ru/' => 2,
  'https://ru.wikipedia.org/wikif/%D0%9C%D0%B0%D0%BA%D1%84%D0%B0' => 1,
  'http://ru.makfapasta.com/producftion/product/pasta/' => 1,
  'http://ru.mafkfapasta.com/' => 1,
  'https://www.utkonocs.ru/item/42/1096522' => 1,
  'https://www.makfa.rur/' => 1,
  'https://ru.wikipedia.org/wiki/%D0%9C%D0%B0%D0%BA%D1%84%D0%B0' => 1,
  'http://ru.makfapasta.com/production/product/pasta/' => 1,
  'https://www.utkonos.ru/item/42/1096522' => 1,
  'https://www.makfa.ru/' => 1,
  'http://ru.makfapasta.com/' => 1,
];

echo '<table>';
foreach ($a as $url => $num) {
  echo '<tr>';
  echo '<td>' . $url . '</td>';
  echo '<td>' . $num . '</td>';
  echo '</tr>';
}
echo '</table>';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question