3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "[[Some text]] and [[one more here]]"; echo preg_replace_callback("/\[\[(.+?)]]/", function($m) { return '<a href="/XLab/?document=' . str_replace(' ', '_', $m[1]) . '">' . $m[1] . '</a>'; }, $text);

preferences:
24.13 ms | 405 KiB | 5 Q