fork download
  1. <?php
  2.  
  3. $results = '<span class="crAvgStars" style="white-space:no-wrap;"><span class="asinReviewsSummary" name="B00KFQ04CI" ref="cm_cr_if_acr_cm_cr_acr_pop_" getargs="{&quot;tag&quot;:&quot;&quot;,&quot;linkCode&quot;:&quot;sp1&quot;}">
  4.  
  5. <a href="http://rads.stackoverflow.com/amzn/click/B00KFQ04CI" target="_top"><img src="https://i...content-available-to-author-only...n.com/images/G/01/x-locale/common/customer-reviews/ratings/stars-4-5._CB192238104_.gif" width="55" alt="4.3 out of 5 stars" align="absbottom" title="4.3 out of 5 stars" height="12" border="0" /></a>&nbsp;</span>(<a href="http://rads.stackoverflow.com/amzn/click/B00KFQ04CI" target="_top">203 customer reviews</a>)</span>';
  6.  
  7. preg_match('/(\d+) customer reviews/',$results, $clean_results);
  8. print_r($clean_results);
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 203 customer reviews
    [1] => 203
)