PHP program to find or count number of elements in a array

Here i am writing program of PHP how to find or count number of elements in a array.
Here i am using to function count() and sizeof() to find number of elements in an array.

Definition and How To Usage count() Function

The count() function returns the number of elements in an array.

<?php
    $arr = array(11,22,33,44,55,66,77,88,99,111);
    echo count($arr);
?>

Output is: 10

Definition and How To Usage sizeof() Function

The sizeof() function returns the number of elements in an array.
The sizeof() function is an alias of the count() function.

<?php
    $arr = array(11,22,33,44,55,66,77,88,99);
    echo sizeof($arr);
?>

Output is: 9

Leave a Reply

Related Posts: You may like

Find Armstrong Number

Write a program find Factorial of a number

Write a PHP program to Print table of Number

Write a PHP program to print prime number

PHPKIDA Offering Free Tools:

INSTA DOWNLOADER

Download Instagram Videos & Photos.

Download Now

CURRENCY CONVERTER

Real Time Currency Converter

Convert Now

ROBOST.TXT GEN.

Robots.txt File Creater

Create Now

HTML MINIFIER

Compress yout HTML Code

Minify Now

CSS MINIFIER

Compress yout CSS Code

Minify Now

JAVASCRIPT MINIFIER

Compress yout JavaScript Code

Minify Now

Sign up for weekly update

Milkshake is almost ready. If you're interested in testing it out, then sign up below to get exclusive access.