-
-
Save aschempp/4343854 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$arrMap = array(1=>17, 34=>98); | |
$strBody = ' | |
Nina Gerling said On Thu, Dec 30. 2010 | |
I\'d recomment using the headline like I recommended in ticket #326: | |
my comment on this, also watch out on #34, but do not convert @#6 but | |
#1 should be'; | |
$strBody = preg_replace_callback('/([\n| ])#([0-9]+)/', 'replaceTickets', $strBody); | |
function replaceTickets($matches) | |
{ | |
global $arrMap; | |
if (isset($arrMap[$matches[2]])) | |
{ | |
return $matches[1].'#'.$arrMap[$matches[2]]; | |
} | |
else | |
{ | |
return $matches[1].'http://www.contao-forge.org/issues/'.$matches[2]; | |
} | |
} | |
var_dump($strBody); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment