title: PHP Extract numbers from a string
body: <p><strong>I want to extract numbers from a string in PHP like following :</strong></p>
  
  <p>if the <strong>string = 'make1to6'</strong> i would like to extract the numeric character before and after the 'to' substring in the entire string. i.e. <strong>1 and 6 are to be extracted</strong></p>
  
  <p>i will be using these returned values for some calculations.' i would like to extract the numeric character before and after the 'to' substring in the entire string. i.e. 1 and 6 are to be extracted</p>
  
  <p>The length of the string is not fixed and can be a max of 10 characters in length.The number can be of max two digits on either side of 'to' in the string.</p>
  
  <p>Some example string values :</p>
  
  <pre><code>sure1to3
  ic3to9ltd
  anna1to6
  joy1to4val
  make6to12
  ext12to36
  </code></pre>
  
  <p>thinking of something like :</p>
  
  <pre><code>function beforeTo(string) {
  
      return numeric_value_before_'to'_in_the_string;
  
  }
  
  
  function afterTo(string) {
  
      return numeric_value_after_'to'_in_the_string;
  
  }
  </code></pre>
  
  <p>i will be using these returned values for some calculations.</p>