php xpath get specifc element by attribute -


i'm trying element specific attribute ("data-image-id").

i got this:

$dom = new domdocument; @$dom->loadhtml($html); $xpath = new domxpath($dom); $links = $xpath->query('//div[@data-image-id]/@data-image-id'); die(var_dump($links)); 

but got following:

object(domnodelist)#3 (1) { ["length"]=> int(0) }  

i want elements attribute "image-data-id".

what doing wrong?


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -

php - How can I echo out this array? -