Hey guys, I need help with this,
suppose I have the following data $datastring
<data>
data here...
</data>
<data>
data here...
</data>
<data>
data here...
</data>
<data>
data here...
</data>
.....
I do the following:
preg_match_all("|<data>(.*)</data>|sm", $datastring, $result)
for($i = 0, $i < count($result[1]; $i++) {
$data_num = $i + 1;
echo "Data ".$data_num.": ".Data$result[1][$i]."<br>";
}
The match result seems to be correct, however, the accumulated data_num is 1, which means the match has occured only once??? What was wrong here? Is there a better regular expression? or method?
Thanks!