我想在变量中匹配一些字符串。如果$var
末尾有"i"或"an",则返回true。
$__var = preg_replace('/^(i|an)$/','',$var);
但是它返回0 (false)。
的例子:
$var = "kesehatan";
应该返回true
删除^
,否则您将只匹配i
或an
。