Answer the question
In order to leave comments, you need to log in
How to make one array from arrays containing one variable?
I have a variable $a, if I do print_r($a), then it is displayed
Array ( [0] => 22 ) Array ( [0] => 2 ) Array ( [0] => 6, 7 )
How to do one array from that? It is important that the number of arrays in a variable can be different.
Answer the question
In order to leave comments, you need to log in
$result = array();
foreach($a as $_a)
{
$result = $result + $_a;
}
If I understand correctly, and you want to
do
something from:
1) array_column
2) cycles
3) array_walk_recursive
4) RecursiveIteratorIterator and cycle
A few hours ago, I gave you a code that collects all these values into one array.
How to connect arrays?
The fact is that print_r($a) can return a result of the form: Array ( [0] => 22 ) Array ( [0] => 2 ) Array ( [0] => 6, 7 )
only if it was called 3 (three) times.
those. your variable IS an array with one argument [0] that changes each time print_r($a) is called.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question