A way of compacting an array of arrays into an array of values.
Say you have an NxM matrix, where each child array represents a row, and you want to iterate over the first element in each row: foreach(mapindex(0, $matrix) as $firstelem) ...
- function map_index($index, $array)
- $out = array();
- foreach($array as $row)
- $out = $row[$index];
- return $out;
You need to login to post a comment.