- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
count() function in PHP
The count() function counts elements in an array, or properties in an object. It returns the number of elements in an array.
Syntax
count(arr, mode)
Parameters
arr − The specified array.
mode − Specifies the mode. Possible values are 0 or 1. 0: Do not count all the elements, 1: Count all the elements.
Return
The count() function returns the number of elements in an array −
Example
The following is an example −
<?php $products = array("Electronics","Footwear"); echo count($products); ?>
Output
2
- Related Articles
- strcmp() function in PHP
- strcoll() function in PHP
- strcspn() function in PHP
- strip_tags() function in PHP
- stripcslashes() function in PHP
- stripos() function in PHP()
- stristr() function in PHP
- stripslashes() function in PHP
- strlen() function in PHP
- strnatcasecmp() function in PHP
- strnatcmp() function in PHP
- strncasecmp() function in PHP
- strncmp() function in PHP
- strpbrk() function in PHP
- strpos() function in PHP

Advertisements