json to php code , need function improvement
<p>My site has lot of javascript, our frontend designer embedded settings code as json format, in js files . I need to this settings json value, from php server . and there are some dynamic changes. I coverted this settings json value into php array .. there are lot of them . so I written a function to convert into php code format</p>

<p>I have written a function <code>toPhp</code>, which is posted in <a href="http://jsfiddle.net/2HKMU/" rel="nofollow">http://jsfiddle.net/2HKMU/</a></p>

<p>I tried to convert one js file settings into php code .. which works ..</p>

<pre><code>var config_topfive = {
    "type":"topfive", 
    "options":{ 
        "ascending":false, "percentage":true, "limits":[25,5] 
    }
};

console.log( toPhp( config_topfive ) );
</code></pre>

<p>which prints </p>

<pre><code>array(
    "type" =&gt; "topfive", 
    "options" =&gt;  array(
        "ascending" =&gt; false, 
        "percentage" =&gt; true, 
        "limits" =&gt; array(25,5)
    )
)
</code></pre>

<p>I would like to know, I miss anything on this conversion .. how could I improve this function more better ..</p>

<p>I know <code>json_decode</code> , but I would like to keep this <code>setting json value in js file ,which made by designer</code>  in to php config file .. eg : <code>config_topfive.php</code> . I will copy paste console print of this function <code>console.log( toPhp( config_topfive ) )</code> into php file </p>

<p>so final my php code in <code>config_topfive.php</code> look like</p>

<pre><code>&lt;?php

return array(
    "type" =&gt; "topfive", 
    "options" =&gt;  array(
        "ascending" =&gt; false, 
        "percentage" =&gt; true, 
        "limits" =&gt; array(25,5)
    )
);
</code></pre>
