writing this:
$likes = $xpath->query('//span[@class="LikesCount"]');
this is waht I get:
155 like
I would like to write the query so that number_before_like > 5
$likes = $xpath->query('
((int)substring-before(//span[@class="LikesCount"], " ")) > 5
');
Follows the markup:
<div class="pin">
[...]
<a href="/pin/56787645270909880/" class="PinImage ImgLink">
<img src="http://media-cache-ec3.pinterest.com/upload/56787645270909880_d7AaHYHA_b.jpg" alt="Krizia" data-componenttype="MODAL_PIN" class="PinImageImg" style="height: 288px;">
</a>
<p class="stats colorless">
<span class="LikesCount">
2 likes
</span>
<span class="RepinsCount">
6 repins
</span>
</p>
[...]
</div>
You can do this with XPath syntax alone, by making sure that extraneous whitespace is taken out of the picture.
Alternatively, let PHP do the hard work for you.
If you’re going to start asking PHP to do some of the work, it might well just be easier to use a simple query and filter the results as you need.