replace first occurrence from right and left side of string
<p>I tried to replace first occurance of a json string <code>{</code> from right side, and left side <code>}</code> . </p>

<pre><code>$json_data = preg_replace( '/\{/' , '', $json_data ,1 );
$json_data = rtrim( $json_data ,'}' ); // here is issue
</code></pre>

<p>but string like this <code>{"chart":"c12","series":{"name":"Test","data":[]}}</code> replaced into </p>

<pre><code>"chart":"c12","series":{"name":"Test","data":[]
</code></pre>

<p>The rtrim replaced '}}' . how to replace the first occurance of <code>}</code> from the right side of string ?</p>
