fetchNodeById( 'F' ) ->isDescendantOf( $tree->fetchNodeById( 'NonMetals' ) ) ) { echo "Flourine is a non-metal.
\n"; } if ( $tree->isDescendantOf( 'O', 'NonMetals' ) ) { echo "Oxygen is a non-metal.
\n"; } $nonMetals = $tree->fetchSubtree( 'NonMetals' ); echo "We found {$nonMetals->size} non-metals: \n"; foreach ( $nonMetals->nodes as $node ) { echo "- {$node->id}: {$node->data} \n"; } ?>