Skip to content

Instantly share code, notes, and snippets.

@aguimaraes
Created August 11, 2016 14:19
Show Gist options
  • Save aguimaraes/8a53227c837c034eb1deae54fa3a3130 to your computer and use it in GitHub Desktop.
Save aguimaraes/8a53227c837c034eb1deae54fa3a3130 to your computer and use it in GitHub Desktop.
<?php
$expectedLength = count(reset($values));
$diffLength = count(array_intersect_key(...$values));
if ($diffLength !== $expectedLength) {
throw new LengthException("Element size differs ({$diffLength} should be {$expectedLength})");
}
$items = array_map(function (...$items) {
return $items;
}, ...$values);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment