T
T
Timur Nigmetov2017-10-10 12:44:33
PHP
Timur Nigmetov, 2017-10-10 12:44:33

How to form an array from the values ​​of other arrays?

Hai. Help me come up with an implementation to create an array.
It is necessary to collect another from the values ​​of some arrays. How to implement this is shown in the figure below. Thank you.
59dc95ff77596548499832.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
display: block, 2017-10-10
@ElectricVst

php 5.6+

function compose_arrays(...$arrays){
    foreach($arrays as $array){
        for($i = 0; $i < count($array); $i++){
            $array_out[$i][] = $array[$i];
        }
    }
    return $array_out;
}

Finish and it will be possible to use.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question