title: Recreate this jquery while in php
body: <p>I have this code in my jQuery:</p>
  
  <pre><code>var pattern = /\d+/g;
  var retorno = [];
  var aux;
  var inputTxt = "30/60/90"
  
  while (aux = pattern.exec(inputTxt)){
      retorno.push(aux[0]);
  }
  </code></pre>
  
  <p>I need to do something very similar in php, I was trying </p>
  
  <p><code>while ($aux = $pattern.exec($inputTxt)){</code> to <code>while ($aux = $pattern.exec($inputTxt)){</code> <strong>To:</strong></p>
  
  <pre><code>preg_match($pattern, $frm_condicao_de_pagamento, $aux, PREG_OFFSET_CAPTURE);
  for($i = 0; $i &lt; count($aux); $i++){
  </code></pre>
  
  <p>But this error occurs: <em>"E_WARNING : type 2 -- preg_match() [function.preg-match]: Unknown modifier 'g' -- at line 5"</em> and I'm not even sure if I should be using <code>preg_match()</code>function to do this.</p>
  
  <p>The idea of the code is to check if the data is (a Arithmetical progression OR numbers with a specific format (this is being tested inside the loop)).</p>
  
  <p>So, the result should be: <code>array(30,60,90);</code></p>