Can someone help me with some PHP please.
The original code ~works, but the output is in the wrong order.
So I need to REVERSE the sequence/order of the JSON array.
But when I try to reverse the sequence with PHP (extract) code below:
$json = file_get_contents($url,0,null,null);
$tmp = json_decode($json, true); // using a temp variable for testing
$result = array_reverse($tmp); // <--new line to reverse the arrray
foreach ($result['data'] as $event) {
echo '<div>'.$event['name'].'</div>';
It doesnt reverse the output sequence.
What am I doing wrong?
Is there another/better way?
PS – I can do it in Javascript, but I need to do it server-side.
You do the reversion, but on the wrong field. You want to reverse the
datafields instead of the array: