Das PHP Script Verzeichnis

Die Funktion erlaubt das automatische Verlinken von Twitter Usernamen

function linkify_twitter_status($status_text)
{
  // linkify URLs
  $status_text = preg_replace(
    '/(https?://S+)/',
    '<a href="1">1</a>',
    $status_text
  );

  // linkify twitter users
  $status_text = preg_replace(
    '/(^|s)@(w+)/',
    '1@<a href="http://twitter.com/2">2</a>',
    $status_text
  );

  // linkify tags
  $status_text = preg_replace(
    '/(^|s)#(w+)/',
    '1#<a href="http://search.twitter.com/search?q=%232">2</a>',
    $status_text
  );

  return $status_text;
}

Quelle