-
-
Notifications
You must be signed in to change notification settings - Fork 469
Closed
Description
Hi. Consider this string (note that the first img tag is between p tag):
$str = '<p><img src="http://example.com/first.jpg"></p><img src="http://example.com/second.jpg">';With this PHP code:
$dom = (new Dom)->load($str);
$images = $dom->find('img');
foreach ($images as $image) {
echo $image->src;
}Expected output:
http://example.com/first.jpg
http://example.com/second.jpg
Actual output:
http://example.com/second.jpg
http://example.com/first.jpg
Furthermore, below code returns second element. while it should return first element:
$image = $dom->find('img', 0);
$image->src; // http://example.com/second.jpgI mean, I get wrong elements order. Any help?