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 />";
}
?>
Related examples in the same category