⊗ppPmSFLT 282 of 447 menu

Loop and HTML Table Generation in PHP

Let's now learn how to generate tables. Suppose we have the following array containing the text of the table cells:

<?php $arr = [ ['name' => 'user1', 'age' => 30, 'salary' => 500], ['name' => 'user2', 'age' => 31, 'salary' => 600], ['name' => 'user3', 'age' => 32, 'salary' => 700], ]; ?>

Let's use a loop to generate the following code from this array:

<table> <tr> <td>user1</td> <td>30</td> <td>500</td> </tr> <tr> <td>user2</td> <td>31</td> <td>600</td> </tr> <tr> <td>user3</td> <td>32</td> <td>700</td> </tr> </table>
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline