⊗ppPmSFAEO 288 of 447 menu

Inserting Array Elements into HTML Code

You can also insert array elements. Let's see how it's done. Suppose we have the following array:

<?php $arr = [1, 2, 3, 4, 5]; ?>

Let's insert each of its elements into a separate paragraph:

<p><?= $arr[0] ?></p> <p><?= $arr[1] ?></p> <p><?= $arr[2] ?></p> <p><?= $arr[3] ?></p> <p><?= $arr[4] ?></p>

Given an array:

<?php $arr = ['a' => 1, 'b' => 2, 'c' => 3]; ?>

Also given three paragraphs:

<p></p> <p></p> <p></p>

Perform the insertion of the array elements into the corresponding paragraphs.

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