I have a loop that contains a string of comma seperated values.
foreach ($profiles as $profile) {
$user_states[] = exlpode(', ', '[string of comma seperated states]');
}
The problem I'm experiencing is the $user_states
array ends up being two levels, with each itteration of the loop creating a nested array.
array (size=2)
0 =>
array (size=3)
0 => string 'DC' (length=2)
1 => string 'Maryland' (length=8)
2 => string 'Northern-Virginia' (length=17)
1 =>
array (size=1)
0 => string 'North-Carolina,Virginia' (length=23)
How can I take exploded values and place them all into a single array? Thanks!
explode()
returns an array. If you assign arrays as new elements into your target array$user_states
you obviously get an array of arrays. – arkascha Oct 26 '14 at 17:24