ArrayMerge | Available in Javascript and PHP

ArrayMerge

Summary

ArrayMerge is a simple script, written in both PHP and JavaScript for merging data from one array into another.

ArrayMerge is like JOIN, but for arrays.

The arrayMerge Call

arrayMerge(array1, array1Opts, array2, array2Opts);

array1: The array to merge into

array1Opts:

  • type: "flat" or "associative" (Default flat)
  • mergeProp: The property name to use to merge with array2. Omit for key in associative array1

array2: The array to perform lookups

array2Opts:

  • type: "flat" or "associative" (Default associative)
  • mergeProp: The property name to use to merge with array1. Omit for key in associative array2
  • fields: "all", "new", array("field1", "field2", "field3") (Default "new")

Javascript Examples

ArrayMerge.js is loaded on this page so feel free to open your developer tools and play in the console.

arrayMerge(array1, array1Opts, array2, array2Opts);

PHP Examples


Explore Chakra7 Today