hey, guys today I am going to show you how to make a Facebook Style Hashtag, Mention and link system in PHP.
So if you use any social networking platform like Instagram, facebook, twitter etc you might be aware of hashtags like #HackerRahul, mentions like @HackerRahul or links that are converted automatically from a simple text string to clickable link dynamically.
So today here is a small function that you can use to extract #hashtags,@username or links from any sting no matter how long the string is or how many hashtags, link or username it contains, it will extract and convert them into clickable links. so that you can fetch hashtag in a search result and click the username to redirect to the particular user’s profile and links to redirect to that website directly by clicking the link.
So here is the function which converts #hashtag, @username or link into clickable links.
It works as it looks out for any hashtag, username or link the string and convert it into a clickable link, it’s that easy.
Here are the full source codes of the tutorial as I have explained it by making a small wall system like facebook.
You can look the demo above and you can use this function wherever you want
this is a short tutorial.
Subscribe to my blog and youtube channel if you like this post and comment if you have any problem.
Thanks a lot.