Replace multiple occurrence of words in string PHP
<p>I just want to replace the following string:</p>

<pre><code>This is my first sentence.
.:.
This is my second sentence.
.:.
This is my third sentence.
.:.
</code></pre>

<p>The output should be like:</p>

<pre><code>This is my first sentence.
1
This is my second sentence.
2
This is my third sentence.
3
</code></pre>

<p>How can I do it in more efficient and easy way?</p>
