Home / PHP Tips Generated By ChatGPT / Counting the Number of Elements in an Array or Properties in an Object in PHP Use count() to determine the number of elements in an array. Source Code $arr = [1, 2, 3, 4, 5]; echo "Number of elements: " . count($arr);