Does not work, the $1-value is lost when calling the function:
echo preg_replace('"\b(http://\S+)"', '<a href="$1">'.findTopDomain('$1').'</a>', $text);
Works fine, outputs: stackoverflow.com
echo preg_replace('"\b(http://\S+)"', '<a href="$1">'.findTopDomain('http://stackoverflow.com/questions/ask').'</a>' , $text);
I need to send the $1 value to a function from within preg_replace. What am I doing wrong?