Differences From Artifact [f3e3fd0aee]:

To Artifact [3d8f44387b]:


714
715
716
717
718
719
720




721
722
723
724
725
726
727

    static public function array_transpose(array $array): array
    {
        $out = [];
        $max = 0;

        foreach ($array as $rows) {




            $max = max($max, count($rows));
        }

        foreach ($array as $column => $rows) {
            // Match number of rows of largest sub-array, in case there is a missing row in a column
            if ($max != count($rows)) {
                $rows = array_merge($rows, array_fill(0, $max - count($rows), null));







>
>
>
>







714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731

    static public function array_transpose(array $array): array
    {
        $out = [];
        $max = 0;

        foreach ($array as $rows) {
            if (!is_array($rows)) {
                throw new \InvalidArgumentException('Invalid multi-dimensional array: not an array: ' . gettype($rows));
            }

            $max = max($max, count($rows));
        }

        foreach ($array as $column => $rows) {
            // Match number of rows of largest sub-array, in case there is a missing row in a column
            if ($max != count($rows)) {
                $rows = array_merge($rows, array_fill(0, $max - count($rows), null));