Chrome Extension

Get array length in PHP

<?php
    $arr = ["1", "2", "3"];
    echo count($arr);
?>
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool
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?
0 Comments
Join Devsheet Ask a Question