Skip to content

Instantly share code, notes, and snippets.

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