Created
February 13, 2016 17:20
-
-
Save colindecarlo/7942875c8dbef0fb6153 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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