preg_replace替换PHP代码
有一段PHP代码,我想让至之间的字符全部变为大写
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> a = '<a><?php $str = \'0\'; if($str==\'0\'){ echo $str; } ?></a>'; echo preg_replace("/<a>(.*?)/es",'"</a><a>".strtoupper("\\1")."</a>"',$a);
$a = '<a><?php $str = \'0\'; if($str==\'0\'){ echo $str; } ?></a>'; echo preg_replace_callback("/<a>(.*?)/s", 'foo', $a); function foo($r) { return "</a><a>".strtoupper($r[1])."</a>"; } <div class="clear"> </div>