shakyj
1
I have a an array that looks like this
array0( array1("values0"), array2("values1"))
What I can’t figure out is how I get the values from array2 in a new array or a foreach loop.
It’s probably quite obvious and I am just being slow today… 
Thanks 
shakyj
2
Found it. Completely obvious.
$newarray = array_values($array0[1]);
shakyj
3
Ok, I tried that. After the first foreach loop $sub contains the keys and values of array1() but I want array2().
How do I get that one?
rpkamp
4
Or, as a general function:
function array_flatten($array)
{
$newArray=array();
foreach($array as $value)
{
if (is_array($value))
$newArray=array_merge($newArray, array_flatten($value));
else
$newArray[]=$value;
}
}
var_dump(array_flatten($array));
shakyj
5
Thanks loads to both of you.
It’s been a long day… 
foreach ($array0 as $sub)
{
foreach ($sub as $v)
{
$newarray[] = $v;
}
}
print_r($newarray);