This Forum has been archived there is no more new posts or threads ... use this link to report any abusive content
==> Report abusive content in this page <==
Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A script that detects hashtags in PHP?
11-09-2012, 08:52 PM
Post: #1
A script that detects hashtags in PHP?
Anybody know how I could create a script that detects hashtags(like twitter) so during the submit script it would find any #then a word. Please help, send me a link to a tutorial or explain how; I know basic php. I'm still learning.

Ads

Find all posts by this user
Quote this message in a reply
11-09-2012, 09:00 PM
Post: #2
 
You are going to want to look into php's regular expressions, or regex. This will do what you are looking for. Some people find it complicated at the beginning, but once you understand them, then they become an indispensable tool. Just be careful not to over use them. They are resource heavy and many developers use them in place of inherit string functions. This is a mistake. Learn what the proper uses are for them, and what is simply a waste of resources.


Cheers,

Gitlez

Ads

Find all posts by this user
Quote this message in a reply
11-09-2012, 09:00 PM
Post: #3
 
I dunno.
Something like

$match = preg_match('/#/',$yourvariable);
if($match) {
//do something here
} else {
//do something else here
}
maybe?
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)