php

Get array length in PHP

<?php
    $arr = ["1", "2", "3"];
    echo count($arr);
?>
Output
3

To get the length of an array in PHP you can use its inbuild function count() which takes array as a parameter and returns array length.

Was this helpful?