У меня есть массив в php под названием $ json. Это выглядит так
Array (
[0] => Array (
[name] => Knife
[url] => http://steamcommunity.com/market/listings/753/297120...
[price] => 0.16 USD
[image] => http://steamcommunity-a.akamaihd.net/economy/imag...
[quantity] => 30
[game] => Counter-Strike: Global Offensive )
[1] => Array (
[name] => Strange Knife
[url] => http://steamcommunity.com/market/listings/440/Strange%2...
[price] => 0.55 USD
[image] => http://steamcommunity-a.akamaihd.net/economy/imag...
[quantity] => 177
[game] => Team Fortress 2 )
[2] => Array (
[name] => Festive Knife
[url] => http://steamcommunity.com/market/listings/440/Festive%20Knife" id="resultlink_2
[price] => 3.72 USD
[image] => http://steamcommunity-a.akamaihd.net/economy/image/fWFc82js0fmoRAP-qOIPu5THSWqffx
[quantity] => 66
[game] => Team Fortress 2 )
[3] => Array (
[name] => â… Flip Knife
[url] => http://steamcommunity.com/market/listings/7
[price] => 3.72 USD
[image] => http://steamcommunity-a.akamaihd.net/economy/image/fWFc82js0fmoRAP-qOIPu5THSWqffx
[quantity] => 24
[game] => Counter-Strike: Global Offensive )
...
Как я могу удалить часть массива, где GAME! = «Counter-Strike: Global Offensive»?
$array; // Your array.
foreach($array as $subarray) {
if($subarray['game'] != "Counter-Strike: Global Offensive") {
unset($subarray);
}
}
Других решений пока нет …