⊗ppPmArDm 54 of 447 menu

How to View Array Contents in PHP

You cannot view the entire contents of an array using echo. If you try to do this, the word Array will simply be displayed on the screen:

<?php $a = [1, 2, 3]; echo $a; // will output 'Array' ?>

To make PHP display all the elements of the array, you need to use the function var_dump:

<?php $a = [1, 2, 3]; var_dump($a); ?>

Given an array:

<?php $a = ['a', 'b', 'c']; ?>

Display this array on the screen using the command echo and using the function var_dump.

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