Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $input = [ [1,2,3], [4,5,6], [7,8,9] ];
- for ($i = 0; $i < count($input); $i++) {
- $res[] = [
- array_shift($input[0]),
- array_shift($input[1]),
- array_shift($input[2])
- ];
- }
- //output
- Array
- (
- [0] => Array
- (
- [0] => 1
- [1] => 4
- [2] => 7
- )
- [1] => Array
- (
- [0] => 2
- [1] => 5
- [2] => 8
- )
- [2] => Array
- (
- [0] => 3
- [1] => 6
- [2] => 9
- )
- )
Advertisement
Add Comment
Please, Sign In to add comment