<?php //convert hashtags function gethashtags($text) { //Match the hashtags $hashtag = ''; // For each hashtag, strip all characters but alpha numeric foreach($matchedHashtags[0] as $match) { } } //to remove last comma in a string } //convert text to clickable links function convert_clickable_links($message) { $parsedMessage = preg_replace(array('/(?i)\b((?:https?:\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?«»“â€â€˜â€™]))/', '/(^|[^a-z0-9_])@([a-z0-9_]+)/i', '/(^|[^a-z0-9_])#([a-z0-9_]+)/i'), array('<a href="$1" target="_blank">$1</a>', '$1<a href="">@$2</a>', '$1<a target="_blank" href="http://codexpresslab.blogspot.com.ng/search?q=$2">#$2</a>'), $message); return $parsedMessage; } $txt="hello man this is #hashtags tutorial. http://codexpresslab.blogspot.com/"; echo convert_clickable_links($txt); ?>