File/includes/set_emulation.inc.php

Description

Utility functions to emulate Pascal data type 'set' with PHP arrays

Functions
array_addtoset (line 62)

Add a single element, or a set, to a set

  • return: set plus the first parameter
array array_addtoset (mixed $element, array $array)
  • mixed $element: single element or array (set), to be added
  • array $array: set to which the first parameter is to be added
array_removefromset (line 41)

Removes a single element, or a subset, from a set

Based on a user contribution from doug at NOSPAM dot thrutch dot co dot uk 06-Jan-2006 01:22 on http://www.php.net/array_diff

  • return: set minus the first parameter
array array_removefromset (mixed $element, array $array)
  • mixed $element: single element or array (subset), to be removed
  • array $array: set from which the first parameter is to be removed
array_subset (line 23)

Checks if array1 is a subset of array2

  • return: TRUE if array1 is a subset of array2, FALSE otherwise
bool array_subset (array $array1, array $array2)
  • array $array1: array1: possible subset of array2
  • array $array2: array2: array which possibly contains array1 as a subset

Documentation generated on Sun, 26 Nov 2006 14:19:36 +0100 by phpDocumentor 1.3.1