title: Find phone numbers in a string
body: <p>In PHP I'm searching for phonenumbers in a certain text.
  I use <code>explode()</code> to divide the text in different parts,using the area code of the city I'm searching for as the delimiter. The problem is that phonenumbers that include the <em>same</em> numbers as the area-code are not returned well.</p>
  
  <p>For example:</p>
  
  <p><code>"foofoo 010-1234567 barbar"</code> splits into <code>"foofoo "</code> and <code>"-1234567 barbar"</code></p>
  
  <p>but</p>
  
  <p><code>"foofoo 010-1230107 barbar"</code> splits into <code>"foofoo "</code>, <code>"-123"</code> and <code>"7 barbar"</code> !</p>
  
  <p>I can use the first one to reconstruct the phonenummer with the areacode, but the second goes wrong of course...</p>
  
  <p>I guess I need a regular expression to split the text with some kind of mechanism to <em>not</em> split on short strings, instead of <code>explode()</code> , but I don't know how to do it.</p>
  
  <p>Any ideas or a better way to search for phonenumbers in a text ?</p>
  
  <p><em><strong>UPDATE:</em></strong>
  The format is NOT consistent, so looking for the hyphen is no solution. Some phone numbers have spaces between the area code and number, some have hooks, some have nothing, etc.   Dutch phonenumbers have an areacode of 2,3 or 4 numbers and are usually 10 numbers in total.</p>