3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = "And so @Nick said to @Joe, hello!\n"; $contentWithMentions = $content; preg_match_all('/\s\@\w+/',$content,$matches); foreach ($matches[0] as $match) { $contentWithMentions = str_replace("$match", '<a href="user.php?user=#">'.$match.'</a>', $contentWithMentions); } echo $contentWithMentions; $contentWithMentions = preg_replace('/\s\@\w+/', '<a href="user.php?user=#">'."$0".'</a>', $content); echo $contentWithMentions;
Output for git.master, git.master_jit, rfc.property-hooks
And so<a href="user.php?user=#"> @Nick</a> said to<a href="user.php?user=#"> @Joe</a>, hello! And so<a href="user.php?user=#"> @Nick</a> said to<a href="user.php?user=#"> @Joe</a>, hello!

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:
53.74 ms | 1528 KiB | 4 Q