php - Simple HTML Dom: How to nest foreach loop to correctly echo output -


sorry if title confusing, couldn't find correct words formulate correctly.

a little bit of context: i'm trying data 2 classes , echo them 1 line.

here's code:

foreach ($site->find('.version a') $source) { foreach ($site->find('.version_numb') $pwgetframe) { $pwframe = $pwgetframe->innertext;  $geturl = $source->href;  $pwversion = $source->plaintext;  echo '<div class="linkframe"><a href="'.$geturl.'">'.$pwversion.'</a><div>'.$pwframe.'</p></div>';    } } 

this code made each linkframe inside previous linkframe making inception.

what can make work correctly?

although it's not clear understand you're after question, believe you're looking following:

$source = $site->find('.version a'); $pwgetframe = $site->find('.version_numb');  ($i=0; $i < sizeof($source); $i++) {     $pwframe = $pwgetframe[$i]->innertext;     $geturl = $source[$i]->href;     $pwversion = $source[$i]->plaintext;     echo '<div class="linkframe"><a href="'.$geturl.'">'.$pwversion.'</a><div>'.$pwframe.'</p></div>'; } 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

python - Django-cities exits with "killed" -

python - How to get a widget position inside it's layout in Kivy? -