php - How to select all elements except specific one? -


i have structure this:

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

and here code:

$data = $html->find('div', 0); foreach($data->find('a') $article){   echo $word .= $article->plaintext."<br>"; } 

and here current result:

one 2 3 

and here expected result:

two 3 

as see in above result, want select <a> element except 1 has test classname. how can that?

note: use this php library.

my suggestion (didn't test it):

$data = $html->find('div', 0); foreach($data->find('a') $article){   if($article->getattribute('class') != 'test'){     echo $word .= $article->plaintext."<br>";   } } 

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 -