I need to extend the functionality of the following code snippet to convert spaces -only- between PRE tags in a string containing html:
str_replace(' ',' ',$str);
For example, if $str cotained the following string;
<p>abc 123</p>
<pre class="abc" id="123">abcedfg 12345</pre>
it would be converted to:
<p>abc 123</p>
<pre class="abc" id="123">abcedfg 12345</pre>
similarly;
<p>abc 123</p>
<pre>abcedfg 12345</pre>
would be converted to:
<p>abc 123</p>
<pre>abcedfg 12345</pre>
Took me a while… But it works.