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 -

dataset - MPAndroidchart returning no chart Data available -

post - imageshack API cURL -