function transpose($array) {
array_unshift($array, null);
return call_user_func_array('array_map', $array);
}
Or if you’re using PHP 5.6 or later:
function transpose($array) {
return array_map(null, ...$array);
}
More Related Contents:
- How to filter an array by a condition
- PHP multidimensional array search by value
- PHP syntax for dereferencing function result
- PHP foreach change original array values [duplicate]
- Passing arrays as url parameter
- Access array returned by a function in php
- Are arrays in PHP copied as value or as reference to new variables, and when passed to functions?
- PHP Multiple Checkbox Array
- glob() – sort array of files by last modified datetime stamp
- PHP – Accessing Multidimensional Array Values
- How to get single value from this multi-dimensional PHP array
- How to re-index the values of an array in PHP? [duplicate]
- Convert array of single-element arrays to a one-dimensional array
- Type hinting – specify an array of objects
- Convert an associative array to a simple array of its values in php
- Posting array from form
- CSV to Associative Array
- Check if a specific value exists at a specific key in any subarray of a multidimensional array
- How to pass an array via $_GET in php?
- How to get common values from two different arrays in PHP [closed]
- Get the maximum value from an element in a multidimensional array? [duplicate]
- Move an array element to a new index in PHP
- PHP get all arguments as array?
- Convert PHP array string into an array
- Remove zero values from a PHP array
- How to iterate through a nested stdClass? [duplicate]
- How to get the object or class name?
- PHP convert nested array to single array while concatenating keys?
- Group array data on one column and sum data from another column to form a flat associative array
- Convert delimited string into array key path and assign value