我必须测试字符串是以还是以+开头。Preg_match如果字符串以“00”{数字}或“+”{number}开头
伪代码:
Say I have the string **0090** or **+41**
if the string begins with **0090** return true,
elseif string begins with **+90** replace the **+** with **00**
else return false
的最后两个数字可以是0-9。
我该如何做到这一点在PHP?
选择我的答案@streetparade谢谢,但看看由codaddict答案。 – 2010-03-29 09:17:23
if(preg_match(“!^(?: 00 | \ +)(?:\ d \ d)!”,$ input)> 0){}请参阅codaddict的[answer](#2536697)。 – 2010-03-29 08:43:30