How to: compare array with string and create hastags before tweeting

Posted by krike on Stack Overflow See other posts from Stack Overflow or by krike
Published on 2011-01-03T08:29:18Z Indexed on 2011/01/03 8:53 UTC
Read the original article Hit count: 139

Filed under:
|

Let's say I have the following array (which is the returned value of a database query):

Array ( [0] => PHP [1] => Webdesign [2] => Wordpress [3] => Drupal [4])

And the following string:

Working With Wordpress Shortcodes

How can I compare the array with the string to see if the string contains any word stored in the array? (hopefully that made sense to you :d )

When he finds a match (eg: Wordpress) it should create a hashtag like so:

Working With #Wordpress Shortcodes

© Stack Overflow or respective owner

Related posts about php

Related posts about arrays