求一个preg_replace匹配的正则表达式
用PHP ,preg_replace函数匹配一个正则
字符串为”house and market and “
替换掉最后一个and,要输出结果为”house and market “
试了半天没写出来,谢谢各位大侠给个匹配的正则
——解决方案——————–
<?php
$str = “house and market and “;
$str = preg_replace(‘/and(\s*)$/’, ”, $str);
var_dump($str);
?>
如何
本文来源gaodai.ma#com搞##代!^码@网*
搞gaodaima代码
。