title: Remove All Text 2 Places After Decimal Place PHP
body: <p>I'm trying to scrape a products price from a page, however unfortunately it's not in a nice clean div so I'm having to clear all the other junk.</p>
  
  <p><strong>Note</strong>: I have looked at several examples however they all assume you only have  nice organised numbers in your variable, not raw HTML stuffed on the end.</p>
  
  <p><strong>An example of the string my variable may hold:</strong></p>
  
  <pre><code>$2.87 &lt;span&gt;10% Off Sale&lt;/span&gt;
  </code></pre>
  
  <p>I've played about with substr and sttrpos, read the manual and still can't figure it out on my own.</p>
  
  <p>I want to just cut the string two digits after the first decimal place is found... No doubt it's extremely simple when you know how!</p>
  
  <p><strong>What I want to end up with:</strong></p>
  
  <pre><code>$2.87
  </code></pre>
  
  <p>An example of the mess I've got myself into trying:</p>
  
  <pre><code>$whatIWant = substr($data, strrpos($data, ".") + 2);
  </code></pre>
  
  <p>Thanks in advance,</p>