Skip to content

Instantly share code, notes, and snippets.

@colindecarlo
Last active February 13, 2016 12:30
Show Gist options
  • Save colindecarlo/b9900d8df470a688929f to your computer and use it in GitHub Desktop.
Save colindecarlo/b9900d8df470a688929f to your computer and use it in GitHub Desktop.
<?php
function transpose ($matrix) {
return array_reduce(array_keys($matrix[0]), function ($transposed, $column) use ($matrix) {
$transposed[] = array_column($matrix, $column);
return $transposed;
}, []);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment