If you want to skip all of the elements which don’t have the achieved
element with a value of 1
, you can use the continue
statement to skip the rest of your processing and move on the the next item in the list.
foreach ( $xml11->achievements->children() as $items ){
if ( $items->achieved != 1 ) continue;
// ... rest of your code
}
solved xml get single elements from children() via php [closed]