PHP中是否有一个函数可以用来替换另一个特定字符,但是我应该能够限制替换次数吗?我目前正试图让preg_replace()工作,因为它有这种能力,但似乎有些不对劲.这是我正在使用的:
$args[0] = preg_replace("/\$/", $args[$x], $args[0], 1);
$args[0] contains letters and special "$" characters, which should be replaced.
Run Code Online (Sandbox Code Playgroud)
有帮助吗?