3v4l.org

run code in 300+ PHP versions simultaneously
<?php $body = ' <p style="margin:20px auto; font-size:20px;"> hello,this is a new function ,Very happy! oh yes <img src="https://example.com/foo.jpg" title="happy"> <a href="https://www.google.com" title="happy"></a> </p>'; $str = htmlspecialchars_decode($body); $keywords = [ 0=>['id'=>1,'title'=>'function','url'=>'https://www.example.com/goodMood'], 1=>['id'=>2,'title'=>'hello','url'=>'https://www.example.com/happy'], 2=>['id'=>3,'title'=>'happy','url'=>'https://www.example.com/happy1'], ]; $content = array_reduce($keywords, function ($c, $v) { return preg_replace('/(' . $v['title'] . ')/', '<a style="color:red;" href="'. $v['url'] . '">$1</a>', $c); }, $str); echo $content;
Output for git.master, git.master_jit, rfc.property-hooks
<p style="margin:20px auto; font-size:20px;"> <a style="color:red;" href="https://www.example.com/<a style="color:red;" href="https://www.example.com/happy1">happy</a>">hello</a>,this is a new <a style="color:red;" href="https://www.example.com/goodMood">function</a> ,Very <a style="color:red;" href="https://www.example.com/happy1">happy</a>! oh yes <img src="https://example.com/foo.jpg" title="<a style="color:red;" href="https://www.example.com/happy1">happy</a>"> <a href="https://www.google.com" title="<a style="color:red;" href="https://www.example.com/happy1">happy</a>"></a> </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:
124.83 ms | 407 KiB | 5 Q