Can anybody let me know the way i could count the potential cases of a keyword inside a block of text?
I have split searching term up into separate tokens, so simply need to tell you and perform a count for each instance and getting rid of punctuation or any other special figures when creating the count.

Next, if a person has placed search phrases encircled by double quotes, i wish to have the ability to skip explode, but simply count cases of that exact phrase. It does not need to be situation sensitive and I must remove punctuation in the phrase when you are performing the count.

Third, in the two cases i wish to have the ability to ignore wordpress and html tags.

Lastly, if anybody know worthwhile lessons for relevant searches that answer the questions above, that will awesome too.

I have got this far.

$results = $wpdb->get_results($sql);

    $tokens = explode('search_terms');

    // Re-arrange Relevant Results
    foreach ($results As $forum_topic){

        foreach($tokens As $token){

            // count tokens in topic_title
            if ($token ){

            }

        }

    }