Outputting array contents as nested list in PHP

后端 未结 5 1824
谎友^
谎友^ 2021-01-20 08:49

I have the array array ( [0] => array(1,2,3,4,5) [1] => array(6,7,8,9,10)) and I would like to display it like this:

5条回答
  •  难免孤独
    2021-01-20 09:43

    Updated to take into account your actual array structure

    Your solution is a simple nested foreach.

    $tab = array(array(1,2,3,4,5), array(6,7,8,9,10));
    echo '
      '; foreach ($tab as $chunks) { echo '
    • '; foreach($chunks as $chunk) { echo '' . $chunk . ''; } echo '
    • '; } echo '
    ';

提交回复
热议问题