3v4l.org

run code in 300+ PHP versions simultaneously
<?php $Rtm = '@[ Test Career 12](career:235)@[ Testing11](business:2)@[ Username](user:1)some text'; $Rtm = preg_replace_callback('/@\[([^]]*)\]\(([a-z]+):([^)]*)\)/', function ($match) { switch($match[2]) { case 'user': return "<a href=\"/en/main/profile_page_link/$match[3]\">$match[1]</a>"; break; case 'business': return "<a href=\"/en/business/1/about\">$match[1]</a>"; break; case 'career': return "<a href=\"/en/main/2/about\">$match[1]</a>"; break; default: return ""; break; } }, $Rtm); echo $Rtm;

preferences:
25.33 ms | 404 KiB | 5 Q