Hi, I am trying to replace all occurances of the word cat with cat1 on the first occurance cat2 on the second occurance and so on. Is this possible with ereg_replace or str_replace and if so can anyone provide an example of code that will do it? Here is the code I have so far. Thanks!
<?
$file = fopen("/home/httpd/html/scripts/test.txt", "r");
$rf = fread($file, 20000);
$grab = eregi("beginclip(.*)endclip", $rf, $printing);
$printing[1] = ereg_replace("cat", "catwhat goes here", $printing[1]);
fclose($file);
echo $printing[1];
?>