/functions/arrays.php

Description

arrays.php

Contains utility functions for array operations

Functions
array_combine (line 128)

Creates an array by using one array for keys and another for its values (PHP 5)

  • return: combined array on success, false on failure
  • author: Marc Groot Koerkamp
mixed array_combine (array $aK, array $aV)
  • array $aK: array keys
  • array $aV: array values
sqm_array_get_value_by_offset (line 105)

Retrieve an array value n positions relative to a reference value.

  • return: false on failure (or if the found value is false)
  • author: Marc Groot Koerkamp
mixed sqm_array_get_value_by_offset (array $a, mixed $v, int $p)
  • array $a: array
  • mixed $v: reference value
  • int $p: offset to reference value in positions
sqm_array_kmove_value (line 46)

Move array value 2 array values by position and maintain keys

  • author: Marc Groot Koerkamp
bool sqm_array_kmove_value ( &$a, mixed $v, int $p, array $a)
  • array $a: (recursive) array
  • mixed $v: value to move
  • int $p: positions to move
  • &$a
sqm_array_merge (line 173)

Merges two variables into a single array

Similar to PHP array_merge function, but provides same functionality as array_merge without losing array values with same key names. If the values under identical array keys are both strings and $concat_strings is TRUE, those values are concatenated together, otherwise they are placed in a sub-array and are merged (recursively) in the same manner.

If either of the elements being merged is not an array, it will simply be added to the returned array.

If both values are strings and $concat_strings is TRUE, a concatenated string is returned instead of an array.

  • return: The merged $a and $b in one array
  • author: Paul Lesniewski
  • since: 1.5.2
array sqm_array_merge (mixed $a, mixed $b, [boolean $concat_strings = true])
  • mixed $a: First element to be merged
  • mixed $b: Second element to be merged
  • boolean $concat_strings: Whether or not string values should be concatenated instead of added to different array keys (default TRUE)
sqm_array_move_value (line 79)

Move array value 2 array values by position. Does not maintain keys

  • author: Marc Groot Koerkamp
bool sqm_array_move_value ( &$a, mixed $v, int $p, array $a)
  • array $a: (recursive) array
  • mixed $v: value to move
  • int $p: positions to move
  • &$a
sqm_array_swap_values (line 23)

Swaps two array values by position and maintain keys

  • return: true on success
  • author: Marc Groot Koerkamp
bool sqm_array_swap_values ( &$a, mixed $v1, mixed $v2, array $a)
  • array $a: (recursive) array
  • mixed $v1: value 1
  • mixed $v2: value 2
  • &$a

Documentation generated on Sat, 07 Oct 2006 16:08:51 +0300 by phpDocumentor 1.3.0RC6