Home > Backend Development > PHP Tutorial > 用ereg判断字符串是否包含星号怎么表示

用ereg判断字符串是否包含星号怎么表示

WBOY
Release: 2016-06-23 14:14:08
Original
933 people have browsed it

用ereg判断字符串是否包含星号怎么表示


回复讨论(解决方案)

strpos 就可以完成

var_dump(@ereg('\*', 'abc')); //bool(false)
var_dump(@ereg('\*', 'a*c')); //int(1)

ereg 函数组已被列入废止计划。建议不要再使用,以免引起不必要的麻烦

所有的正则特殊意义的字符都可以通过转义字符 \ 取消掉特殊意义,例如\? \. \* 都是仅仅指代? . *字符

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