Guest_imported
New member
- Jan 1, 1970
- 0
hi,
i need some help doing a find and replace on a text string. I want to replace every instance of "%0D%0D" with "&value$i=" within the text string, where $i is a number that increments for each replace.
This is the code I'm using at the moment:
for ($i=0; $i<substr_count($string,"%0D%0D" $i++)
{
$new_string = str_replace ("%0D%0D", "&value$i=", $string);
}
There are 5 instances of "%0D%0D" in the text string. With the above code it does replace all the "%0D%0D"'s to "&value$i=", but they all read as "&value5=". But I need them to read: "&value1=" for the first instance of "%OD%OD", "&value2=" for the second instance of "%OD%OD", and so on up to "&value5=".
Any ideas??
thanks,
jc
i need some help doing a find and replace on a text string. I want to replace every instance of "%0D%0D" with "&value$i=" within the text string, where $i is a number that increments for each replace.
This is the code I'm using at the moment:
for ($i=0; $i<substr_count($string,"%0D%0D" $i++)
{
$new_string = str_replace ("%0D%0D", "&value$i=", $string);
}
There are 5 instances of "%0D%0D" in the text string. With the above code it does replace all the "%0D%0D"'s to "&value$i=", but they all read as "&value5=". But I need them to read: "&value1=" for the first instance of "%OD%OD", "&value2=" for the second instance of "%OD%OD", and so on up to "&value5=".
Any ideas??
thanks,
jc