Last active
January 3, 2017 17:15
-
-
Save vladislav805/27920375bd7874410baf0f88f50f9710 to your computer and use it in GitHub Desktop.
Rearrange $_FILES from { name = [1, 2, 3], size = [1, 2, 3], ... } to [ { name = 1, size = 1 }, { name = 2, size = 2 }, ... ]
This file contains 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
<? | |
function reArrayFiles(&$files) { | |
$result = []; | |
$keys = array_keys($files); | |
for ($i = 0, $l = sizeof($files["name"]); $i < $l; $i++) { | |
foreach ($keys as $key) { | |
$result[$i][$key] = $files[$key][$i]; | |
}; | |
}; | |
return $result; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment