You are here

function httprl_lossless_assoc_array_merge in HTTP Parallel Request & Threading Library 6

Same name and namespace in other branches
  1. 7 httprl.module \httprl_lossless_assoc_array_merge()

Merge multiple associative arrays into one.

Parameters

...: Arrays to merge.

Return value

Merged array.

See also

http://stackoverflow.com/questions/2148694/how-to-combine-2-associative-...

1 call to httprl_lossless_assoc_array_merge()
httprl_batch_callback in ./httprl.module
Given an array of data, use multiple processes to crunch it.

File

./httprl.module, line 3509
HTTP Parallel Request Library module.

Code

function httprl_lossless_assoc_array_merge() {
  $arrays = func_get_args();
  $data = array();
  foreach ($arrays as $a) {
    foreach ($a as $k => $v) {
      if (isset($data[$k])) {
        $data[] = $v;
      }
      else {
        $data[$k] = $v;
      }
    }
  }
  return $data;
}