$json = json_decode('{"Paladins":{"name":"Paladins","hours":"106","vac":false},"Dota 2":{"name":"Dota 2","hours":"603","vac":false},"Ballistic Protection":{"name":"Ballistic Protection","hours":0,"vac":false},"Black Squad":{"name":"Black Squad","hours":0,"vac":false},"Commander: Conquest of the Americas Gold":{"name":"Commander: Conquest of the Americas Gold","hours":0,"vac":false},"Counter-Strike: Global Offensive":{"name":"Counter-Strike: Global Offensive","hours":"140.1","vac":false},"Cuisine Royale":{"name":"Cuisine Royale","hours":0,"vac":false},"Darwin Project":{"name":"Darwin Project","hours":0,"vac":false},"East India Company Gold":{"name":"East India Company Gold","hours":0,"vac":false},"For Honor":{"name":"For Honor","hours":0,"vac":false},"For Honor - Public Test":{"name":"For Honor - Public Test","hours":0,"vac":false},"Fortified":{"name":"Fortified","hours":0,"vac":false},"Friday the 13th: Killer Puzzle":{"name":"Friday the 13th: Killer Puzzle","hours":0,"vac":false},"H1Z1":{"name":"H1Z1","hours":0,"vac":false},"H1Z1: Test Server":{"name":"H1Z1: Test Server","hours":0,"vac":false},"Half-Life 2: Deathmatch":{"name":"Half-Life 2: Deathmatch","hours":0,"vac":false},"Half-Life 2: Lost Coast":{"name":"Half-Life 2: Lost Coast","hours":"3.7","vac":false},"InfiniPicross":{"name":"InfiniPicross","hours":0,"vac":false},"One Finger Death Punch":{"name":"One Finger Death Punch","hours":0,"vac":false},"Overcast - Walden and the Werewolf":{"name":"Overcast - Walden and the Werewolf","hours":0,"vac":false},"Paladins - Public Test":{"name":"Paladins - Public Test","hours":0,"vac":false},"Pirates of Black Cove Gold":{"name":"Pirates of Black Cove Gold","hours":0,"vac":false},"Quake Champions":{"name":"Quake Champions","hours":0,"vac":false},"S.K.I.L.L. - Special Force 2":{"name":"S.K.I.L.L. - Special Force 2","hours":0,"vac":false},"Saints Row 2":{"name":"Saints Row 2","hours":0,"vac":false},"Save the Lamb":{"name":"Save the Lamb","hours":0,"vac":false},"Shoot Paint":{"name":"Shoot Paint","hours":0,"vac":false},"Sniper Fury":{"name":"Sniper Fury","hours":0,"vac":false},"Soldier of Failure":{"name":"Soldier of Failure","hours":0,"vac":false},"Team Fortress 2":{"name":"Team Fortress 2","hours":"2.6","vac":false},"The Last Hope":{"name":"The Last Hope","hours":0,"vac":false},"Totally Accurate Battlegrounds":{"name":"Totally Accurate Battlegrounds","hours":0,"vac":false},"Unforgiving Trials: The Space Crusade":{"name":"Unforgiving Trials: The Space Crusade","hours":0,"vac":false},"Unturned":{"name":"Unturned","hours":"0.7","vac":false},"World of Tanks Blitz":{"name":"World of Tanks Blitz","hours":"128.1","vac":false}}', true);
$keys = array_map('strtolower',array_keys($json));
$search = [
"counter-strike: global offensive",
"playerunknown's battlegrounds",
];
$prices = [
0 => ['value' => ["counter-strike: global offensive"], 'price' => 60],
1 => ['value' => ["playerunknown's battlegrounds"], 'price' => 75],
2 => [
'value' => [
"counter-strike: global offensive",
"playerunknown's battlegrounds"
],
'price' => 85
]
];
$find = array_intersect($keys, $search);
$price = array_reduce($prices, function($price, $item) use ($find) {
if (empty(array_diff($item['value'], $find))) {
$price = $item['price'];
}
return $price;
}, 0);