• PHP Video Tutorials

PHP - Ds Set remove() Function



Ds\Set::remove() function can remove all given values from the set.

Syntax

public void Ds\Set::remove([ mixed $...values ] )

Ds\Set::remove() function can remove all given values from the set and ignoring any that are not in the set.

Ds\Set::remove() function doesn't return any value.

Example 1

<?php  
   $set = new \Ds\Set([1, 2, 3, 4, 5]); 
   
   echo "The actual set is: \n"; 
   print_r($set); 
   
   $set->remove(2, 3); 
   
   echo "\n The set after removing values: \n"; 
   print_r($set); 
?>

Example 2

<?php  
   $set = new \Ds\Set(["Tutorials", "Point" "India"]); 
   
   echo "The actual set is: \n"; 
   print_r($set); 
   
   $set->remove(1); 
   
   echo "\n The set after removing values: \n"; 
   print_r($set); 
?>
php_function_reference.htm
Advertisements