Alternatively, you could just loop accross the string, and count what you get. This solution is not nearly as nice as the regular expressions. BUT, mastering regular expressions is a pain, and this function works.
<?
function str_pos_mult($haystack,$needle){
$count = 0;
$total=0;
$pos = strpos ($haystack,$needle);
while(!($pos === false)){
$total+=$pos;
$returnarray[$count]=$total;
$haystack=substr($haystack,($pos+1));
$pos = strpos($haystack,$needle);
$count++;
$total++;
}
return $returnarray;
}
$teststring = "abc4def4ghi4j4klmn4opqr4stu4v4wxy4z";
$testarray=str_pos_mult($teststring,"4");
for($x=0;$x<count($testarray);$x++){
print $testarray[$x]."<br>";
}
?>
Hope this helps