Home > Backend Development > PHP Tutorial > php正则表达 去除非数字

php正则表达 去除非数字

WBOY
Release: 2016-06-13 10:28:51
Original
2517 people have browsed it

求一个php正则表达 去除非数字
求一个正则额 去除非数字 比如:
"a1asd2asd3a"
正则过滤后 输出
123

不要intval()或者(int)之类的 因为大于10位数就不行了
谁先回复正确 分送你

------解决方案--------------------
echo preg_replace('/\D/','','a1asd2asd3a');

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template