S
S
Sergey Evstigneev2018-04-23 20:24:16
PHP
Sergey Evstigneev, 2018-04-23 20:24:16

How to get a list from an array?

Guys, help. We have an array of the form:
(a,b,c,d)
(k,l,m,n,o)
...
The number of elements in each line is different. It is necessary to get a list of the following output:
(a,b)
(a,c)
(a,d)
(k,l)
(k,m)
(k,n)
(k,o)
Please help with the solution in the form of php code
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yan-s, 2018-04-23
@sergevstigneev

We make a shift and save the first element php.net/manual/ru/function.array-shift.php
The rest is bypassed in any convenient way, for example foreach

R
Rsa97, 2018-04-23
@Rsa97

array_splice()
array_map()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question