troubleshooting Question

Parsing Configuration File

Avatar of jSherz
jSherzFlag for United Kingdom of Great Britain and Northern Ireland asked on
PHP
2 Comments1 Solution258 ViewsLast Modified:
Please show an example of how I can parse this file into an array in PHP. The ideal output would be the equivalent of making this array (not all values are shown in the example):

array("unlocks" => array(
 "Sprint_Mki" => "1",
 "Sprout_Collect" => "1"
),
"experience" => array(
 "Lumbering" => "36"
));

NB: The configuration file will change to have more values in and the script must accommodate for these changes.
"Out"
{
	"unlocks"
	{
		"Sprint_Mki"		"1"
		"Sprout_Collect"		"1"
		"Grain_Planting"		"1"
		"Sprout_Planting"		"1"
	}
	"experience"
	{
		"Lumbering"		"36"
		"Planting"		"24"
		"Survival"		"0"
		"Mining"		"0"
		"Harvesting"		"24"
		"Weapon_Crafting"		"0"
	}
	"date"		"Monday 02/22/10"
	"skills"
	{
		"Lumbering"		"8"
		"Planting"		"6"
		"Survival"		"6"
		"Mining"		"8"
		"Harvesting"		"6"
		"Weapon_Crafting"		"2"
	}
	"name"		"James"
}
ASKER CERTIFIED SOLUTION
jSherz

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros