Home > Backend Development > PHP Tutorial > 请问怎么从字符串中截取数字

请问怎么从字符串中截取数字

WBOY
Release: 2016-06-23 14:17:32
Original
951 people have browsed it

比如:afsdffsdf9.20sdfsfsdf99sdfsdf14575dfsf

我要截取9.20,99,14575

网上的很多都是把数字提取出来变成9209914575。


回复讨论(解决方案)

$s = 'afsdffsdf9.20sdfsfsdf99sdfsdf14575dfsf';preg_match_all('/[\d.]+/', $s, $r);echo join(',', $r[0]);
Copy after login
9.20,99,14575

谢谢哈,xuzuning大大真是大好人

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