I can not change.
What I really want to do is that. I have RTF file. On the other hand I have an array of values to replace.
Thay way I want to achieve this goal is to open the file with fopen, and then replace variables with values, and also parse condition to show response.
Ok, in that case, your best bet would be to convert the document to a php file and use that as an include file. Either that of use a proper php templating engine. There are many to choose from, the most popular being Smarty, RainTPL and the more recent Twig (which is REALLY cool).
For example, a twig html document would look like this:
And also I could not find ending tag. Starting charrsid8996477 is given and it is ending with "}"
How many are you talking about?
I can't see an easy way around this. Replacing just the if blocks could become a nightmare. It could also be the case where if conditions are a little more complex in some templates, so that your replacement fails.
A few hours converting these files manually may be quicker than writing a fance preg_replace routine that is likely to fail anyway.
There are about 30 files. And as I said these files are being used in other ways / other system. So modification of these files will create duplication, and when a single word in a file need to change, We will have to make these changes in my PHP files too.
To resolve this issue I wanted to use files as these files are provided to me.
I really can't see a way of producing a 'duplicate' php file from these types of template file without writing a hefty custom parser.