• PHP Video Tutorials

PHP - Ds\Collection::clear()



Ds\Collection::clear() function can remove all values.

Syntax

abstract public void Ds\Collection::clear( void )

Ds\Collection::clear() function can remove all values from a collection.

Ds\Collection::clear() function doesn't have any parameters. This function doesn't return any value.

Example-1

<?php
   $collection = new \Ds\Vector([1, 2, 3, 4, 5, 6]); 
   print_r($collection);  

   $collection->clear(); 
   print_r($collection); 
?>

Example-2

<?php 
   $collection = new \Ds\Vector([10, 15, 20, 25, 30, 35]);
   var_dump($collection);
  
   $collection->clear();
   var_dump($collection); 
?>
php_function_reference.htm
Advertisements