0

how to display this array.i tried sevaral way.does not working.

Array
(
    [0] => Array
        (
            [date] => Array
                (
                    [epoch] => 1401197400
                    [pretty] => 7:00 PM IST on May 27, 2014
                    [day] => 27
                    [month] => 5
                    [year] => 2014
                    [yday] => 146
                    [hour] => 19
                    [min] => 00
                    [sec] => 0
                    [isdst] => 0
                    [monthname] => May
                    [monthname_short] => May
                    [weekday_short] => Tue
                    [weekday] => Tuesday
                    [ampm] => PM
                    [tz_short] => IST
                    [tz_long] => Asia/Colombo
                )

            [period] => 1
            [high] => Array
                (
                    [fahrenheit] => 88
                    [celsius] => 31
                )

            [low] => Array
                (
                    [fahrenheit] => 78
                    [celsius] => 26
                )

            [conditions] => Chance of a Thunderstorm
            [icon] => chancetstorms
            [icon_url] => http://icons.wxug.com/i/c/k/chancetstorms.gif
            [skyicon] => 
            [pop] => 60
            [qpf_allday] => Array
                (
                    [in] => 
                    [mm] => 
                )

            [qpf_day] => Array
                (
                    [in] => 0.11
                    [mm] => 3
                )

            [qpf_night] => Array
                (
                    [in] => 0.11
                    [mm] => 3
                )

            [snow_allday] => Array
                (
                    [in] => 
                    [cm] => 
                )

            [snow_day] => Array
                (
                    [in] => 0
                    [cm] => 0
                )

            [snow_night] => Array
                (
                    [in] => 0
                    [cm] => 0
                )

            [maxwind] => Array
                (
                    [mph] => 12
                    [kph] => 19
                    [dir] => SSW
                    [degrees] => 212
                )

            [avewind] => Array
                (
                    [mph] => 12
                    [kph] => 19
                    [dir] => SSW
                    [degrees] => 212
                )

            [avehumidity] => 85
            [maxhumidity] => 0
            [minhumidity] => 0
        )

    [1] => Array
        (
            [date] => Array
                (
                    [epoch] => 1401283800
                    [pretty] => 7:00 PM IST on May 28, 2014
                    [day] => 28
                    [month] => 5
                    [year] => 2014
                    [yday] => 147
                    [hour] => 19
                    [min] => 00
                    [sec] => 0
                    [isdst] => 0
                    [monthname] => May
                    [monthname_short] => May
                    [weekday_short] => Wed
                    [weekday] => Wednesday
                    [ampm] => PM
                    [tz_short] => IST
                    [tz_long] => Asia/Colombo
                )

            [period] => 2
            [high] => Array
                (
                    [fahrenheit] => 88
                    [celsius] => 31
                )

            [low] => Array
                (
                    [fahrenheit] => 78
                    [celsius] => 26
                )

            [conditions] => Chance of a Thunderstorm
            [icon] => chancetstorms
            [icon_url] => http://icons.wxug.com/i/c/k/chancetstorms.gif
            [skyicon] => 
            [pop] => 60
            [qpf_allday] => Array
                (
                    [in] => 
                    [mm] => 
                )

            [qpf_day] => Array
                (
                    [in] => 0.12
                    [mm] => 3
                )

            [qpf_night] => Array
                (
                    [in] => 0.14
                    [mm] => 4
                )

            [snow_allday] => Array
                (
                    [in] => 
                    [cm] => 
                )

            [snow_day] => Array
                (
                    [in] => 0
                    [cm] => 0
                )

            [snow_night] => Array
                (
                    [in] => 0
                    [cm] => 0
                )

            [maxwind] => Array
                (
                    [mph] => 13
                    [kph] => 21
                    [dir] => SSW
                    [degrees] => 197
                )

            [avewind] => Array
                (
                    [mph] => 13
                    [kph] => 21
                    [dir] => SSW
                    [degrees] => 197
                )

            [avehumidity] => 84
            [maxhumidity] => 0
            [minhumidity] => 0
        )

    [2] => Array
        (
            [date] => Array
                (
                    [epoch] => 1401370200
                    [pretty] => 7:00 PM IST on May 29, 2014
                    [day] => 29
                    [month] => 5
                    [year] => 2014
                    [yday] => 148
                    [hour] => 19
                    [min] => 00
                    [sec] => 0
                    [isdst] => 0
                    [monthname] => May
                    [monthname_short] => May
                    [weekday_short] => Thu
                    [weekday] => Thursday
                    [ampm] => PM
                    [tz_short] => IST
                    [tz_long] => Asia/Colombo
                )

            [period] => 3
            [high] => Array
                (
                    [fahrenheit] => 89
                    [celsius] => 32
                )

            [low] => Array
                (
                    [fahrenheit] => 78
                    [celsius] => 26
                )

            [conditions] => Thunderstorm
            [icon] => tstorms
            [icon_url] => http://icons.wxug.com/i/c/k/tstorms.gif
            [skyicon] => 
            [pop] => 80
            [qpf_allday] => Array
                (
                    [in] => 
                    [mm] => 
                )

            [qpf_day] => Array
                (
                    [in] => 0.12
                    [mm] => 3
                )

            [qpf_night] => Array
                (
                    [in] => 0.17
                    [mm] => 4
                )

            [snow_allday] => Array
                (
                    [in] => 
                    [cm] => 
                )

            [snow_day] => Array
                (
                    [in] => 0
                    [cm] => 0
                )

            [snow_night] => Array
                (
                    [in] => 0
                    [cm] => 0
                )

            [maxwind] => Array
                (
                    [mph] => 11
                    [kph] => 18
                    [dir] => SW
                    [degrees] => 220
                )

            [avewind] => Array
                (
                    [mph] => 11
                    [kph] => 18
                    [dir] => SW
                    [degrees] => 220
                )

            [avehumidity] => 84
            [maxhumidity] => 0
            [minhumidity] => 0
        )

    [3] => Array
        (
            [date] => Array
                (
                    [epoch] => 1401456600
                    [pretty] => 7:00 PM IST on May 30, 2014
                    [day] => 30
                    [month] => 5
                    [year] => 2014
                    [yday] => 149
                    [hour] => 19
                    [min] => 00
                    [sec] => 0
                    [isdst] => 0
                    [monthname] => May
                    [monthname_short] => May
                    [weekday_short] => Fri
                    [weekday] => Friday
                    [ampm] => PM
                    [tz_short] => IST
                    [tz_long] => Asia/Colombo
                )

            [period] => 4
            [high] => Array
                (
                    [fahrenheit] => 87
                    [celsius] => 31
                )

            [low] => Array
                (
                    [fahrenheit] => 79
                    [celsius] => 26
                )

            [conditions] => Thunderstorm
            [icon] => tstorms
            [icon_url] => http://icons.wxug.com/i/c/k/tstorms.gif
            [skyicon] => 
            [pop] => 80
            [qpf_allday] => Array
                (
                    [in] => 
                    [mm] => 
                )

            [qpf_day] => Array
                (
                    [in] => 0.21
                    [mm] => 5
                )

            [qpf_night] => Array
                (
                    [in] => 0.27
                    [mm] => 7
                )

            [snow_allday] => Array
                (
                    [in] => 
                    [cm] => 
                )

            [snow_day] => Array
                (
                    [in] => 0
                    [cm] => 0
                )

            [snow_night] => Array
                (
                    [in] => 0
                    [cm] => 0
                )

            [maxwind] => Array
                (
                    [mph] => 12
                    [kph] => 19
                    [dir] => WSW
                    [degrees] => 238
                )

            [avewind] => Array
                (
                    [mph] => 12
                    [kph] => 19
                    [dir] => WSW
                    [degrees] => 238
                )

            [avehumidity] => 85
            [maxhumidity] => 0
            [minhumidity] => 0
        )

    [4] => Array
        (
            [date] => Array
                (
                    [epoch] => 1401543000
                    [pretty] => 7:00 PM IST on May 31, 2014
                    [day] => 31
                    [month] => 5
                    [year] => 2014
                    [yday] => 150
                    [hour] => 19
                    [min] => 00
                    [sec] => 0
                    [isdst] => 0
                    [monthname] => May
                    [monthname_short] => May
                    [weekday_short] => Sat
                    [weekday] => Saturday
                    [ampm] => PM
                    [tz_short] => IST
                    [tz_long] => Asia/Colombo
                )

            [period] => 5
            [high] => Array
                (
                    [fahrenheit] => 86
                    [celsius] => 30
                )

            [low] => Array
                (
                    [fahrenheit] => 79
                    [celsius] => 26
                )

            [conditions] => Thunderstorm
            [icon] => tstorms
            [icon_url] => http://icons.wxug.com/i/c/k/tstorms.gif
            [skyicon] => 
            [pop] => 80
            [qpf_allday] => Array
                (
                    [in] => 
                    [mm] => 
                )

            [qpf_day] => Array
                (
                    [in] => 0.24
                    [mm] => 6
                )

            [qpf_night] => Array
                (
                    [in] => 0.15
                    [mm] => 4
                )

            [snow_allday] => Array
                (
                    [in] => 
                    [cm] => 
                )

            [snow_day] => Array
                (
                    [in] => 0
                    [cm] => 0
                )

            [snow_night] => Array
                (
                    [in] => 0
                    [cm] => 0
                )

            [maxwind] => Array
                (
                    [mph] => 12
                    [kph] => 19
                    [dir] => SW
                    [degrees] => 235
                )

            [avewind] => Array
                (
                    [mph] => 12
                    [kph] => 19
                    [dir] => SW
                    [degrees] => 235
                )

            [avehumidity] => 85
            [maxhumidity] => 0
            [minhumidity] => 0
        )

    [5] => Array
        (
            [date] => Array
                (
                    [epoch] => 1401629400
                    [pretty] => 7:00 PM IST on June 01, 2014
                    [day] => 1
                    [month] => 6
                    [year] => 2014
                    [yday] => 151
                    [hour] => 19
                    [min] => 00
                    [sec] => 0
                    [isdst] => 0
                    [monthname] => June
                    [monthname_short] => Jun
                    [weekday_short] => Sun
                    [weekday] => Sunday
                    [ampm] => PM
                    [tz_short] => IST
                    [tz_long] => Asia/Colombo
                )

            [period] => 6
            [high] => Array
                (
                    [fahrenheit] => 87
                    [celsius] => 31
                )

            [low] => Array
                (
                    [fahrenheit] => 78
                    [celsius] => 26
                )

            [conditions] => Thunderstorm
            [icon] => tstorms
            [icon_url] => http://icons.wxug.com/i/c/k/tstorms.gif
            [skyicon] => 
            [pop] => 80
            [qpf_allday] => Array
                (
                    [in] => 
                    [mm] => 
                )

            [qpf_day] => Array
                (
                    [in] => 0.18
                    [mm] => 5
                )

            [qpf_night] => Array
                (
                    [in] => 0.12
                    [mm] => 3
                )

            [snow_allday] => Array
                (
                    [in] => 
                    [cm] => 
                )

            [snow_day] => Array
                (
                    [in] => 0
                    [cm] => 0
                )

            [snow_night] => Array
                (
                    [in] => 0
                    [cm] => 0
                )

            [maxwind] => Array
                (
                    [mph] => 13
                    [kph] => 21
                    [dir] => SW
                    [degrees] => 234
                )

            [avewind] => Array
                (
                    [mph] => 13
                    [kph] => 21
                    [dir] => SW
                    [degrees] => 234
                )

            [avehumidity] => 86
            [maxhumidity] => 0
            [minhumidity] => 0
        )

    [6] => Array
        (
            [date] => Array
                (
                    [epoch] => 1401715800
                    [pretty] => 7:00 PM IST on June 02, 2014
                    [day] => 2
                    [month] => 6
                    [year] => 2014
                    [yday] => 152
                    [hour] => 19
                    [min] => 00
                    [sec] => 0
                    [isdst] => 0
                    [monthname] => June
                    [monthname_short] => Jun
                    [weekday_short] => Mon
                    [weekday] => Monday
                    [ampm] => PM
                    [tz_short] => IST
                    [tz_long] => Asia/Colombo
                )

            [period] => 7
            [high] => Array
                (
                    [fahrenheit] => 86
                    [celsius] => 30
                )

            [low] => Array
                (
                    [fahrenheit] => 78
                    [celsius] => 26
                )

            [conditions] => Thunderstorm
            [icon] => tstorms
            [icon_url] => http://icons.wxug.com/i/c/k/tstorms.gif
            [skyicon] => 
            [pop] => 80
            [qpf_allday] => Array
                (
                    [in] => 
                    [mm] => 
                )

            [qpf_day] => Array
                (
                    [in] => 0.24
                    [mm] => 6
                )

            [qpf_night] => Array
                (
                    [in] => 0.18
                    [mm] => 5
                )

            [snow_allday] => Array
                (
                    [in] => 
                    [cm] => 
                )

            [snow_day] => Array
                (
                    [in] => 0
                    [cm] => 0
                )

            [snow_night] => Array
                (
                    [in] => 0
                    [cm] => 0
                )

            [maxwind] => Array
                (
                    [mph] => 12
                    [kph] => 19
                    [dir] => SW
                    [degrees] => 232
                )

            [avewind] => Array
                (
                    [mph] => 12
                    [kph] => 19
                    [dir] => SW
                    [degrees] => 232
                )

            [avehumidity] => 85
            [maxhumidity] => 0
            [minhumidity] => 0
        )

    [7] => Array
        (
            [date] => Array
                (
                    [epoch] => 1401802200
                    [pretty] => 7:00 PM IST on June 03, 2014
                    [day] => 3
                    [month] => 6
                    [year] => 2014
                    [yday] => 153
                    [hour] => 19
                    [min] => 00
                    [sec] => 0
                    [isdst] => 0
                    [monthname] => June
                    [monthname_short] => Jun
                    [weekday_short] => Tue
                    [weekday] => Tuesday
                    [ampm] => PM
                    [tz_short] => IST
                    [tz_long] => Asia/Colombo
                )

            [period] => 8
            [high] => Array
                (
                    [fahrenheit] => 87
                    [celsius] => 31
                )

            [low] => Array
                (
                    [fahrenheit] => 79
                    [celsius] => 26
                )

            [conditions] => Thunderstorm
            [icon] => tstorms
            [icon_url] => http://icons.wxug.com/i/c/k/tstorms.gif
            [skyicon] => 
            [pop] => 80
            [qpf_allday] => Array
                (
                    [in] => 
                    [mm] => 
                )

            [qpf_day] => Array
                (
                    [in] => 0.15
                    [mm] => 4
                )

            [qpf_night] => Array
                (
                    [in] => 0.06
                    [mm] => 2
                )

            [snow_allday] => Array
                (
                    [in] => 
                    [cm] => 
                )

            [snow_day] => Array
                (
                    [in] => 0
                    [cm] => 0
                )

            [snow_night] => Array
                (
                    [in] => 0
                    [cm] => 0
                )

            [maxwind] => Array
                (
                    [mph] => 12
                    [kph] => 19
                    [dir] => SW
                    [degrees] => 227
                )

            [avewind] => Array
                (
                    [mph] => 12
                    [kph] => 19
                    [dir] => SW
                    [degrees] => 227
                )

            [avehumidity] => 84
            [maxhumidity] => 0
            [minhumidity] => 0
        )

    [8] => Array
        (
            [date] => Array
                (
                    [epoch] => 1401888600
                    [pretty] => 7:00 PM IST on June 04, 2014
                    [day] => 4
                    [month] => 6
                    [year] => 2014
                    [yday] => 154
                    [hour] => 19
                    [min] => 00
                    [sec] => 0
                    [isdst] => 0
                    [monthname] => June
                    [monthname_short] => Jun
                    [weekday_short] => Wed
                    [weekday] => Wednesday
                    [ampm] => PM
                    [tz_short] => IST
                    [tz_long] => Asia/Colombo
                )

            [period] => 9
            [high] => Array
                (
                    [fahrenheit] => 87
                    [celsius] => 31
                )

            [low] => Array
                (
                    [fahrenheit] => 78
                    [celsius] => 26
                )

            [conditions] => Thunderstorm
            [icon] => tstorms
            [icon_url] => http://icons.wxug.com/i/c/k/tstorms.gif
            [skyicon] => 
            [pop] => 80
            [qpf_allday] => Array
                (
                    [in] => 
                    [mm] => 
                )

            [qpf_day] => Array
                (
                    [in] => 0.18
                    [mm] => 5
                )

            [qpf_night] => Array
                (
                    [in] => 0.24
                    [mm] => 6
                )

            [snow_allday] => Array
                (
                    [in] => 
                    [cm] => 
                )

            [snow_day] => Array
                (
                    [in] => 0
                    [cm] => 0
                )

            [snow_night] => Array
                (
                    [in] => 0
                    [cm] => 0
                )

            [maxwind] => Array
                (
                    [mph] => 12
                    [kph] => 19
                    [dir] => SW
                    [degrees] => 222
                )

            [avewind] => Array
                (
                    [mph] => 12
                    [kph] => 19
                    [dir] => SW
                    [degrees] => 222
                )

            [avehumidity] => 84
            [maxhumidity] => 0
            [minhumidity] => 0
        )

    [9] => Array
        (
            [date] => Array
                (
                    [epoch] => 1401975000
                    [pretty] => 7:00 PM IST on June 05, 2014
                    [day] => 5
                    [month] => 6
                    [year] => 2014
                    [yday] => 155
                    [hour] => 19
                    [min] => 00
                    [sec] => 0
                    [isdst] => 0
                    [monthname] => June
                    [monthname_short] => Jun
                    [weekday_short] => Thu
                    [weekday] => Thursday
                    [ampm] => PM
                    [tz_short] => IST
                    [tz_long] => Asia/Colombo
                )

            [period] => 10
            [high] => Array
                (
                    [fahrenheit] => 87
                    [celsius] => 31
                )

            [low] => Array
                (
                    [fahrenheit] => 77
                    [celsius] => 25
                )

            [conditions] => Thunderstorm
            [icon] => tstorms
            [icon_url] => http://icons.wxug.com/i/c/k/tstorms.gif
            [skyicon] => 
            [pop] => 80
            [qpf_allday] => Array
                (
                    [in] => 
                    [mm] => 
                )

            [qpf_day] => Array
                (
                    [in] => 0.48
                    [mm] => 12
                )

            [qpf_night] => Array
                (
                    [in] => 0
                    [mm] => 0
                )

            [snow_allday] => Array
                (
                    [in] => 
                    [cm] => 
                )

            [snow_day] => Array
                (
                    [in] => 0
                    [cm] => 0
                )

            [snow_night] => Array
                (
                    [in] => 0
                    [cm] => 0
                )

            [maxwind] => Array
                (
                    [mph] => 13
                    [kph] => 21
                    [dir] => SW
                    [degrees] => 226
                )

            [avewind] => Array
                (
                    [mph] => 13
                    [kph] => 21
                    [dir] => SW
                    [degrees] => 226
                )

            [avehumidity] => 83
            [maxhumidity] => 0
            [minhumidity] => 0
        )

)
2
Contributors
4
Replies
29
Views
3 Years
Discussion Span
Last Post by delta_frost
1

What I infer from this var_dump is that your main array consists of 10 elements,each of which is an associative array(again some of them are associative).So to say,output them,the following may help you(assume $data to be the main 10-element array:

<?php
    $data = Array(....
            /*Whatever you have given,here we assume it is the variable $data*/
            .....);
    foreach($data as $record){
        foreach($record as $key=>$value){
            echo '<h3>'.$key.'</h3>'; //This outputs 'date' for the first element,
                                      //'period' for the second element and so on.
            //Now output the innermost associative array as you wish,
            //either loop through it if it's an array or simply echo
            //if it's a variable.
        }       
    }
?>
0
    <?php
        $data = Array(....
                /*Whatever you have given,here we assume it is the variable $data*/
                .....);
        foreach($data as $record){
            echo 'Date :'.$record['date']['pretty'].'<br/>';    
            echo 'Icon URL:'.$record['icon_url'].'<br/>';
            echo 'High :'.$record['high']['fahrenheit'].' degrees Fahrenheit<br/>';
            echo 'Low :'.$record['low']['fahrenheit'].' degrees Fahrenheit<br/>';
        }
    ?>

Modify as necessary

Edited by delta_frost

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.