php - How to select second element between multiple identical classname? -


i have structure this:

<div class="test">     <span>one</span> </div>  <div class="test">     <span>two</span> </div>  <div class="test">     <span>three</span> </div> 

and here code:

foreach($html->find('div[class=test]') $article) {     echo $type .= $article->find('span',0)->plaintext."<br>"; } 

and here current result:

one 2 3 

and here expected result:

two 

how can that?


note: use this php library.

$data = $html->find('div[class=test]', 1); echo $type .= $data->find('span',0)->plaintext."<br>"; 

that should print want 1 second div element select (starts @ 0 first 1 = 0, 2nd = 1).


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -