• PHP Video Tutorials

PHP - Ds Set diff() Function



Ds\Set::diff() function can create a new set by using the values that aren't in another set.

Syntax

public Ds\Set Ds\Set::diff( Ds\Set $set )

Ds\Set::diff() function can return a new set containing all values that aren't in another set.

Example

<?php  
   $set1 = new \Ds\Set([1, 3, 5]);  
   $set2 = new \Ds\Set([1, 3, 6, 9]);  
   
   echo("The difference of set1 and set2: \n");  
   print_r($set1->diff($set2)); 
?>
php_function_reference.htm
Advertisements