⊗ppPmArLn 59 of 447 menu

Array Length in PHP

The length of an array is found using the count function:

<?php $arr = [1, 2, 3]; echo count($arr); // will output 3 ?>

Given the following array:

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

Display the number of elements in this array.

Given the following array:

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

Display the number of elements in this array.

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