3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = '<div><a class="nk" href="http://weibo.cn/u/1610526293?st=968f">阳光下的雪海</a><span class="ctt">:<a href="http://weibo.cn/pages/100808topic?extparam=%E4%B8%AD%E5%9B%BD%E4%B9%8B%E5%A3%B0&amp;from=feed&amp;st=968f" class="k">#中国之声#</a> <a href="http://weibo.cn/sinaurl?f=w&amp;u=http%3A%2F%2Ft.cn%2FzO2NEZA&amp;st=968f">http://t.cn/zO2NEZA</a></span> &nbsp;<a href="http://weibo.cn/attitude/zAueIaySO/add?uid=1704540003&amp;rl=0&amp;st=968f">赞[0]</a>&nbsp;<a href="http://weibo.cn/repost/zAueIaySO?uid=1610526293&amp;rl=0&amp;st=968f">转发[0]</a>&nbsp;<a href="http://weibo.cn/comment/zAueIaySO?uid=1610526293&amp;rl=0&amp;st=968f#cmtfrm" class="cc">评论[0]</a>&nbsp;<a href="http://weibo.cn/fav/addFav/zAueIaySO?rl=0&amp;st=968f">收藏</a><!---->&nbsp;<span class="ct">1分钟前&nbsp;来自手机微博触屏版</span></div>'; echo preg_replace("/(?<=href\=(\"|\'))(.+)(\'|\")/", "\3&afr=ad", $url);

preferences:
32.97 ms | 402 KiB | 5 Q