twitter nicks
format text with format "@format" to link
Usage
[ => <
] => >
A basic example:
-----------------
$string = 'hello friends, I\'m listening @daftPunk and you?';
echo parseTwitterNicks($string, 'all');
return: hello my friends, I'm listening [a href="profile.php?user=daftPunk" title="daftPunk"]@daftPunk[/a] and you?
define template:
-----------------
$string = 'hello friends, I\'m listening @daftPunk and you?';
echo parseTwitterNicks($string, 'all', 'http://www.phpsnaps.com/?user={nick}');
return: hello my friends, I'm listening [a href="http://www.phpsnaps.com/?user=daftPunk" title="daftPunk"]@daftPunk[/a] and you?
return array with matches:
--------------------------
$string = 'hello my friends, I\'m listening @daftPunk, @dubstep music @skrillex and you?';
$matches = parseTwitterNicks($string, 'all', '', true);
print_r($matches);
return: Array ( [0] => daftPunk [1] => dubstep [2] => skrillex )


Comments