1. Go to this page and download the library: Download rinimisini/php-utilities library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rinimisini / php-utilities example snippets
$set = new Set();
$set->add(1);
$set->add(2);
$set->add(3);
if ($set->has(2)) {
echo "Set contains 2";
}
$set->delete(2);
$set->clear();
echo $set->size(); // Outputs the number of elements in the set
$set1 = new Set();
$set1->add(1)->add(2);
$set2 = new Set();
$set2->add(2)->add(3);
$unionSet = $set1->union($set2); // $unionSet contains [1, 2, 3]
$set1 = new Set();
$set1->add(1)->add(2);
$set2 = new Set();
$set2->add(2)->add(3);
$intersectionSet = $set1->intersection($set2); // $intersectionSet contains [2]
$set1 = new Set();
$set1->add(1)->add(2);
$set2 = new Set();
$set2->add(2)->add(3);
$differenceSet = $set1->difference($set2); // $differenceSet contains [1]