2
I’m having a question, how can I do to extract numbers from a PHP string preserving the formatting of it?
I found a solution in the forum in English, but when extracting the numbers the pattern of the date, for example, is not preserved.
$str = 'Paga. ref. a nota fiscal número 8888, com o cheque número 9999 em 14/08/2015';
preg_match_all('!\d+!', $str, $matches);
print_r($matches);
Source: Extract Numbers from a string
Thank you very much, this was the very solution I was looking for!
– Maicon Herverton
That, I had edited by putting these remarks in the code itself. Great, serves for future user questions, because I found that there was nothing similar in the forum to
PHP
– Maicon Herverton