php - How to change separate associative arrays to something usable such as one indexed array? -


print_r($element_attrs); returns following arrays gathered xml file.

array ( [weather-summary] => increasing clouds )  array ( [weather-summary] => thunderstorms )  array ( [weather-summary] => thunderstorms )  array ( [weather-summary] => cloudy )  array ( [weather-summary] => cloudy )  array ( [weather-summary] => sunny )  array ( [weather-summary] => clear )  array ( [weather-summary] => sunny )  array ( [weather-summary] => clear )  array ( [weather-summary] => sunny )  array ( [weather-summary] => clear )  array ( [weather-summary] => sunny )  array ( [weather-summary] => clear )  array ( [weather-summary] => sunny )  array ( [weather-summary] => fair )  array ( ) 

right 16 separate associative arrays in keys same except last 1 that's blank reason. i'd return value second last array array ( [weather-summary] => fair ). i've been experimenting foreach() , for() loops try create either index can retrieve array want or make multidimensional array contains info each array. try treats each array separate , doesn't allow me access data group.

any fabulous. thanks!

try

$weather_array = array(); foreach($element_attrs $val){     $weather_array[] = $val['weather-summary']; } print_r($weather_array); 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -