The Count Function count the total number of element in Array or in object. You can use count function in FOR LOOP when you want access the element of array. For example if we have array:
For example:
$student = array( "Majeed" , "Saleem" , "Noman" , "Qasim");
$total_element=Count($student);
echo $total_elemen;
Although foreach loop easily access the element of array. but you can also use for loop for accessing the element of one dimensional or two dimensional array.
$student = array( "Majeed" , "Saleem" , "Noman" , "Qasim"); $total_element=Count($student); for(i=0 ; i< $total_element ; i++) { echo $student[i] . "
" ; }
Variables in PHP
PHP Concatenation
Calculation in PHP
If Statements in PHP
if ... else Statements in PHP
Nested IF Structure in PHP
PHP Comparison Operators
Switch Statement in PHP
Logical Operators In PHP
PHP Booleans
FOR Loop in PHP
While Loop In PHP
foreach Loop In PHP
Break Statement
Array In PHP
Associative Array
The Count function
Changing Case Function
Trim Function In PHP
Str_shuffle( ) function
strpos function in PHP
Explode() Function in PHP
Function
Passing Function Arguments
Server Variables
Header Function
Include Function
The require Function