fork download
  1. <?php
  2. $html = '
  3. <a href="./?pg=194">194</a><a href="./?pg=2" rel="next" class="next_page">2</a>
  4. ';
  5.  
  6. preg_match_all('/<a.*href="\.\/\?pg=(\d+)".*>(?:.*)<\/a>/', $html, $preg_matches);
  7. echo max($preg_matches[1]);
  8.  
  9.  
Success #stdin #stdout 0.02s 23908KB
stdin
Standard input is empty
stdout
2