3v4l.org

run code in 300+ PHP versions simultaneously
<?php $body = "<p>在过去的一年中,“抖音”通过短视频的形式在人们 <h1>抖音怎么改名字啊?</h1> <img src='https://example.com/test.jpg' title='我想改名字'/></p>"; $keywords = [ 0=>['id'=>1,'title'=>'改名字','url'=>'https://www.example.com/gaimingzi.html'], 1=>['id'=>2,'title'=>'名字','url'=>'https://www.example.com/mingzi.html'], 2=>['id'=>3,'title'=>'短视频','url'=>'https://www.example.com/duanshipin.html'], ]; foreach ($keywords as $keyword) { $body = preg_replace('/(>[^<>]*?)(' . $keyword['title'] . ')([^<>]*?<)/', '$1<a href="'. $keyword['url']. '" target="_blank">$2</a>$3', $body,1); } echo $body;
Output for git.master, git.master_jit, rfc.property-hooks
<p>在过去的一年中,“抖音”通过<a href="https://www.example.com/duanshipin.html" target="_blank">短视频</a>的形式在人们 <h1>抖音怎么<a href="https://www.example.com/gaimingzi.html" target="_blank">改<a href="https://www.example.com/mingzi.html" target="_blank">名字</a></a>啊?</h1> <img src='https://example.com/test.jpg' title='我想改名字'/></p>

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
172.62 ms | 406 KiB | 5 Q