unfortunately $count parameter doest work in php 4

im trying to figure out a way so that preg_replace counts how many times it replaces something in a string prior to php 5?

any help is appreciated thx.