• PHP Video Tutorials

PHP - Ds Vector count() Function



Ds\Vector::count() function can be used to count the number of elements in a vector.

Syntax

int public Ds\Vector::count( void )

Ds\Vector::count() function doesn't have any parameters.

Ds\Vector::count() function can return the number of elements in a vector.

Example 1

<?php 
   $array1 = new \Ds\Vector([1, 2, 4, 6, 8, 10]); 
  
   echo("The vector elements: \n"); 
   print_r($array1); 
  
   echo("The count of vector:"); 
   echo(count($array1));
?>

Example 2

<?php 
   $array1 = new \Ds\Vector(["Tutorials", "Point", "Tutorix"]); 
  
   echo("The vector elements: \n"); 
   print_r($array1); 
  
   echo("The count of vector:"); 
   echo(count($array1)); 
?>
php_function_reference.htm
Advertisements