Does this cause a PHP memory leak?
<p>Does this cause a PHP memory leak?</p>

<pre><code>function xml_parse($xmlString)
{
    return json_decode(json_encode(new SimpleXMLElement($xmlString)), true);
}
</code></pre>

<p>Or do i need to unset the SimpleXML obj like this?</p>

<pre><code>function xml_parse($xmlString)
{
    $sObj = new SimpleXMLElement($xmlString);
    $ret  = json_decode(json_encode($sObj), true);
    unset($sObj);
    return $ret;
}
</code></pre>

<p>I am running this in a large foreach as the script needs to parse lots of files.</p>
