Reputation: 321
i would like to get data out of this multidimensional-array:
Array
(
[result] => success
[source] => getLatestConsoleLogs
[success] => Array
(
[0] => Array
(
[time] => 1324301613
[line] => 2011-12-19 17:33:33 [INFO] [JSONAPI] [API Call] 0:0:0:0:0:0:0:1: method=getLatestConsoleLogs?args=[]
)
[1] => Array
(
[time] => 1324301613
[line] => 2011-12-19 17:33:33 [INFO] [JSONAPI] [API Call] 0:0:0:0:0:0:0:1: method=getLatestConsoleLogs?args=[]
)
[2] => Array
(
[time] => 1324301613
[line] => 2011-12-19 17:33:33 [INFO] [JSONAPI] [API Call] 0:0:0:0:0:0:0:1: method=getLatestConsoleLogs?args=[]
)
)
)
i would be nice, if somehow it could be extracted to div`s. thanks.
Upvotes: 0
Views: 4364
Reputation: 4894
You can just use a normal foreach loop like this:
$successes = $array['success'] /* where $array is the variable holding the result */
foreach($successes as $success) {
echo "<div>Time: " . $success['time'] . " - Line: " . $success['line'] . "</div>";
}
Upvotes: 1
Reputation: 6499
You can so json_encode() to convert your array to JSON and then use javascript to place those in appropriate div's
OR if you want to do it on server side, you can check this
http://www.terrawebdesign.com/multidimensional.php
Upvotes: 1