$string = "Anda mendapatkan penambahan pulsa Rp 100000 dari nomor 6282298981111 tgl 2018-07-08. Cek pulsa melalui *888#. Info CS: 188";
I want to get text 100000 and 6282298981111 how is the code?
Thanks in advance, I'm new in here
$string = "Anda mendapatkan penambahan pulsa Rp 100000 dari nomor 6282298981111 tgl 2018-07-08. Cek pulsa melalui *888#. Info CS: 188";
I want to get text 100000 and 6282298981111 how is the code?
Thanks in advance, I'm new in here
收起
You can use the following regular expression:
preg_match_all('~(?<=\s)\d+(?=\s)~', $string, $matches);
print_r($matches[0]);
At the output, get
Array
(
[0] => 100000
[1] => 6282298981111
)
报告相同问题?