<?php
$arr = [
[
'id' => 'UP0006-CUSA08724_00-BATTLEFIELDV0000',
'attributes' => [
'name' => 'Battlefield V [test1]',
'thumbnail-url-base' => 'https://store.playstation.com/store/api/chihiro/00_09_000/container/US/en/999/UP0006-CUSA08724_00-BATTLEFIELDV0000/1539651459000/image',
'release-date' => '2018-12-14T00:00:00Z'
],
],
[
'id' => 'UP0006-CUSA08724_00-BATTLEFIELDV0000',
'attributes' => [
'name' => 'Battlefield V [test2]',
'thumbnail-url-base' => 'https://store.playstation.com/store/api/chihiro/00_09_000/container/US/en/999/UP0006-CUSA08724_00-BATTLEFIELDV0000/1539651459000/image',
'release-date' => '2018-10-14T00:00:00Z'
],
],
[
'id' => 'UP0006-CUSA08724_00-BATTLEFIELDV0000',
'attributes' => [
'name' => 'Battlefield V [test3]',
'thumbnail-url-base' => 'https://store.playstation.com/store/api/chihiro/00_09_000/container/US/en/999/UP0006-CUSA08724_00-BATTLEFIELDV0000/1539651459000/image',
'release-date' => '2019-10-14T00:00:00Z'
],
],
[
'id' => 'UP0006-CUSA08724_00-BATTLEFIELDV0000',
'attributes' => [
'name' => "Barbie's selfie adventures",
'thumbnail-url-base' => 'https://store.playstation.com/store/api/chihiro/00_09_000/container/US/en/999/UP0006-CUSA08724_00-BATTLEFIELDV0000/1539651459000/image',
'release-date' => '2018-10-18T00:00:00Z'
],
],
];
foreach($arr as $game){
$timeleft = strtotime($game['attributes']['release-date'])-time();
if($timeleft>0) $games[$timeleft] = floor($timeleft/86400) ." days left to ".$game['attributes']['name'] ." \n";
}
ksort($games);
echo implode("", $games);
- Output for 5.6.38, 7.1.0 - 7.1.33, 7.2.0 - 7.2.25, 7.3.0 - 7.3.12, 7.4.0
- 1 days left to Barbie's selfie adventures
58 days left to Battlefield V [test1]
362 days left to Battlefield V [test3]
preferences:
89.22 ms | 402 KiB | 73 Q