Skip to content

Instantly share code, notes, and snippets.

@iolloyd
Created August 24, 2015 19:26
Show Gist options
  • Save iolloyd/64a9d0b4e1c7d03ede63 to your computer and use it in GitHub Desktop.
Save iolloyd/64a9d0b4e1c7d03ede63 to your computer and use it in GitHub Desktop.
[a,b,c,d] => [a => b, c => d]
$chunks = array_chunk($array, 2);
for($i=0, $out=[]; $i < count($chunks); $out[$chunks[$i][0]] = $chunks[$i][1], $i++);
@iolloyd
Copy link
Author

iolloyd commented Aug 24, 2015

Couldn't resist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment