Home >Backend Development >PHP Tutorial >php 正则解决思路

php 正则解决思路

WBOY
WBOYOriginal
2016-06-13 12:08:32824browse

php 正则
把所有非 .(点) -(负) 数字的都替换成空

如:-234.fgfg23   替换成-234.23
      234.中3/3       替换成234.33
------解决思路----------------------

echo preg_replace('/[^.-\d]+/', '', '-234.fgfg23');

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