Hello, I need to obtain the last two-dimensional associative arrangement but I do not know how to go through each element of the first dimension, and make it "end () to obtain the last record of each one.
It is according to "time" I must extract the last one and leave them in a new array.
What I want to do is get the last message of each number ("author"). get the last one with "time"
$url = 'http://gnex.cl/ajax/json.json';
$result = file_get_contents($url); // Send a request
$data = json_decode($result, 1); // Parse JSON
$agrupados = array();
foreach($data['messages'] as $currmsg)
{
if (!isset($agrupados[$currmsg['author']]))
{
$agrupados[$currmsg['author']] = array();
}
array_push($agrupados[$currmsg['author']], $currmsg);
}
ACA I HAVE THE PROBLEM OF HOW TO IMPLEMENT END AND ADD TO $ hello = array ()
$hola = array();
foreach ($agrupados as $key => $value) {
print $key."<p>";
foreach ($value as $key => $value_1) {
foreach ($value_1 as $key_1 ) {
//if($key_1['author']){
array_push(end($hola[$value_1['time']]), $value);
//}
# code...
}
}