cip6791 Posted January 29, 2011 Share Posted January 29, 2011 Hi, I want to recognize let s say "..." in a text. How can that be accomplished in php? And maybe put all "..." into an array. Anybody have any idea how this can be done? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/226034-recognizing-text-with-php/ Share on other sites More sharing options...
AV1611 Posted January 29, 2011 Share Posted January 29, 2011 Yes it can be done but your question is so vague that it's hard to say how. Quote Link to comment https://forums.phpfreaks.com/topic/226034-recognizing-text-with-php/#findComment-1166895 Share on other sites More sharing options...
cip6791 Posted January 29, 2011 Author Share Posted January 29, 2011 Ok ... so let s say I have post on a blog, and I want to select the word "does" from that post. I want to know how many times the word "does" shows up in the post. Quote Link to comment https://forums.phpfreaks.com/topic/226034-recognizing-text-with-php/#findComment-1166902 Share on other sites More sharing options...
doddsey_65 Posted January 29, 2011 Share Posted January 29, 2011 <?php // your string $str = 'this is a post post post post'; // Count the number of occurences: $count = preg_match_all( '/post/', $str, $blank); // print occurences echo "Count is: $count<p>$str</p>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/226034-recognizing-text-with-php/#findComment-1166907 Share on other sites More sharing options...
cip6791 Posted January 29, 2011 Author Share Posted January 29, 2011 Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/226034-recognizing-text-with-php/#findComment-1167021 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.