Open In App

PHP | Ds\Vector count() Function

Last Updated : 22 Aug, 2019
Comments
Improve
Suggest changes
1 Like
Like
Report
The Ds\Vector::count() function is an inbuilt function in PHP which is used to count the number of elements in the vector. Syntax:
int public Ds\Vector::count( void )
Parameters: This function does not accepts any parameter. Return Value: This function returns the number of elements in the vector. Below programs illustrate the Ds\Vector::count() function in PHP: Program 1:
Output:
Vector elements
Ds\Vector Object
(
    [0] => 1
    [1] => 2
    [2] => 3
    [3] => 4
    [4] => 5
    [5] => 6
    [6] => 7
    [7] => 8
)
Count vector elements: 8
Program 2:
Output:
Vector elements
Ds\Vector Object
(
    [0] => geeks
    [1] => for
    [2] => geeks
)
Count vector elements: 3
Reference: http://php.net/manual/en/ds-vector.count.php

Next Article

Similar Reads