I’m trying to get my foreach to skip certain children in the xml based on one of the childrens values. The first code works for skipping just 1 but I want to skip a lot. The second code won’t skip any of them.
<?php
$gamespage = simplexml_load_file("http://gamepage.com/games?xml=1");
foreach($gamespage->games->game as $game)
{
$gid = $game->appID;
if ($gid != 65920) {
} }
second code (not skipping any):
<?php
$gamespage = simplexml_load_file("http://gamepage.com/games?xml=1");
foreach($gamespage->games->game as $game)
{
$gid = $game->appID;
if ($gid != 65920 || $gid != 40940 || $gid != 50110 || $gid != 8990) {
} }
You need to use
&&instead of||Or even better