Last active
December 30, 2015 05:49
-
-
Save invmatt/7785237 to your computer and use it in GitHub Desktop.
Retrieve the JSON tweet text and replace all @username with links to profile. (using https://docs.google.com/file/d/0B6SP5Ft5Ty22SmJjSE9WOHh0RmM/edit?pli=1)
This file contains hidden or 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 | |
| // Match Twitter handles and create a link to the profile | |
| $string = $value["text"]; | |
| $input = preg_replace('/(?<=^|\s)@([a-z0-9_]+)/i', '<a href="http://www.twitter.com/$1">@$1</a>', $string); | |
| echo $input; | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment