PHP Config.ini file parsing with multi-level arrays

Viewed 1583

I have a config.ini file that has a number of these types of variables:

site.social.twitter = "URL"
site.social.facebook = "URL"
site.social.google-plus = "URL"

I use PHP's built-in function to parse the INI.

$config = parse_ini_file(__DIR__ ."/../config.ini");

The next step is to get this (site.social.twitter) to become an array.

$config['site']['social']['twitter']

You could just 'explode()', but it doesn't quite get there. Is there any simpler solutions to something like this?

2 Answers
Related