String Replacement (Help Please)

A

Anonymous

Guest
Hi,

you are right but logically its wrong for you application.

Just do one thing

take each and every word in array.

now count the array.

now use for loop and take each and every element of array and compare the word which you want to replace.

if you found which you want to replace

then

$your_array[$i] = "replacing_word";

where $i is for loop inc variable.


http://mukeshvariya.blogspot.com
 
Hi,

I understand your problem.

dont worry I will create a function and let you know.

but for your side, you have to create two arrays

one : which contains your words to be replace
two : which contains existing words you would like to replace.

so simply

you have to execute two for loops.
arr_replacing_words

Code:
suppose 5
your statement words: 10

for($i=0;i<5;i++)
{
          for($j=0;$j<10;%j++)
          {
                      if($i array_element == $j array_element)
                              replace by i array;
           }
}


I think this is good logic for any no of words you want to replace.

please dont forgot to visit:
http://mukeshvariya.blogspot.com
 
Back
Top