Mega Code Archive

 
Categories / Php / Strings
 

Substr_count php

<?php    $buzzwords = array("this", "is", "test"); $talk = <<< talk this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. talk;    foreach($buzzwords as $bw) {       echo "The word $bw appears ".substr_count($talk,$bw)." time(s).<br />";    } ?>