List horizontally data from array


enter image description here

This is the result I’ve got. But I wan to display it horizontally. Can anyone help me?
Here’s my code:

for($j = 0; $j < count($sub); $j++){
     echo "
        <table class='table'>
                    <th scope='col'>" . $sub[$j] . "</th>


Your subjects should be ths in one tr:

echo "<table class='table'><thead><tr>";
for($j = 0; $j < count($sub); $j++){
    echo "<th scope='col'>" . $sub[$j] . "</th>";
echo "</tr></thead></table>";

Fiddle here.

Answered By – u_mulder

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published