It is necessary from the link to get the content, namely the number 719

<a href="http://anysite.ru/?product_tag=719" rel="tag">719</a> 
  • Here the number 719 occurs twice. - Nick Volynkin
  • ";<a href="http://anysite\.ru/\?product_tag=(\d+)" rel="tag">(\d+)</a>;i" - mymedia

1 answer 1

I see here several solutions. The first is to use XML.

 $xmlstr='<a href="http://anysite.ru/?product_tag=719" rel="tag">719</a>'; $movies = new SimpleXMLElement($xmlstr); echo $movies->a; 

The second method of regular season

 preg_match_all('/product_tag=([0-9]+)/', $xmlstr, $result); print_r($result);