Hello. Im having trouble with preg_match_all. Im trying to
make preg find all instances of test in a string, and then
print out how many it found with a for loop. The problem is
that only three test's are printet out. There are six in total.
Below is the script :
<?
$text1 = "Test 1, test 2, test 3, test 4, test 5, test 6";
for ($t=0; $t<count($text1); $t++) {
preg_match_all("/test/i", $text1, $match1);
print "<br>".$match1[0][$t];
}
echo "<hr>";
?>
What am I doing wrong ?