$arr = Array ( 0 => "hello", 1 => "there", 2 => null, 3 => null, 4 => 3, );var_dump(count($arr));Output:
Bạn đang xem: How to find array length in php
Works for me w/ NULL
$array = array("hello", "there", NULL, NULL, 3);emang đến "".print_r($array, true)."";echo "Count: ".count($array)."";output
Array( <0> => hello <1> => there <2> => <3> => <4> => 3)Count: 5A quiông chồng Google tìm kiếm for PHPhường Array should pull up results of all the functions available
$a = array( 0 => "hello", 1 => "there", 2 => null, 3 => null, 4 => 3,);var_dump(count($a));Can you please provide more information about null not being counted? An older version maybe? Or simply messing with the rest of us? :)
EDIT: well, posted wrong code :)
Thanks for contributing an answer lớn Stack Overflow!Please be sure khổng lồ answer the question. Provide details và share your research!
But avoid …Asking for help, clarification, or responding lớn other answers.Making statements based on opinion; baông chồng them up with references or personal experience.
To learn more, see our tips on writing great answers.
Post Your Answer Disthẻ
Not the answer you're looking for? Browse other questions tagged php arrays count key or ask your own question.
site thiết kế / hình ảnh © 2021 Staông xã Exchange Inc; user contributions licensed under cc by-sa. rev2021.8.5.39930