multilevel array from a config string

53 views Asked by At

Is ist possible to split a string into a multi-level array?

get an array that looks like this:

array(
  'admin.config.user' => 'marvin',
  'admin.dir.root' => '/var/www/'
);

and i want to get an array that looks like this:

array(
  'admin' => array(
    'config' => array(
      'user' => 'marvin'
    ),
    'dir' => array(
      'root' => '/var/www/'
    )
  )
);

Any ideas how to handle this?

0

There are 0 answers