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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-23 14:17:32984browse

比如:afsdffsdf9.20sdfsfsdf99sdfsdf14575dfsf

我要截取9.20,99,14575

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


回复讨论(解决方案)

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

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

Statement:
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