PHP generate javascript objects with multiple properties -


i did function generates php array javascript object, instance

$this->routes = array(         'module' => array(             'route1' => $renderer->url('route1', array('lang' => $lang_short)),             'route2' => $renderer->url('route1', array('lang' => $lang_short)),         )     ); 

my function generate javascript object

{static: {module: {route1: 'route1', route2: 'route2'}}} 

so can access in js

static.module.route1 

the "problem" method made handles arrays 2 nested arrays, not more. nice , easy way achieve this?

use native json_encode function, instead of custom function.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

visual studio 2010 - Connect to informix database windows form application -

android - Associate same looper with different threads -