Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

map function to loop through multiple arrays in parallel #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sujancse
Copy link

@sujancse sujancse commented Mar 10, 2020

It will work like list comprehension in Elixir, Python

Usage Example

$array1 = array(1,2,3);
$array2 = array(4,5,6);

$data = map(function($item1, $item2) {
	    return $item1 * $item2;
}, $array1, $array2);

// [4,10,18]

The helper can take variable number of arrays.

@calebporzio

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant