$a = " #0 and #1 or (#0)";
$items = array(
    "a>1",
    "b>0"
);
$str = preg_replace("/#(\w+)/","\$items[$1]",$a);
echo $str;输出结果: $items[0] and $items[1] or ($items[0])
怎么才能让输出结果是:a>1 and b>0 or (a>1)?
请各位大神帮忙看一下,谢谢!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
正则