Link to home
Start Free TrialLog in
Avatar of Member_2_5212910
Member_2_5212910Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Parsing Configuration File

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.
		"Sprint_Mki"		"1"
		"Sprout_Collect"		"1"
		"Grain_Planting"		"1"
		"Sprout_Planting"		"1"
		"Lumbering"		"36"
		"Planting"		"24"
		"Survival"		"0"
		"Mining"		"0"
		"Harvesting"		"24"
		"Weapon_Crafting"		"0"
	"date"		"Monday 02/22/10"
		"Lumbering"		"8"
		"Planting"		"6"
		"Survival"		"6"
		"Mining"		"8"
		"Harvesting"		"6"
		"Weapon_Crafting"		"2"
	"name"		"James"

Open in new window

Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Are you sure you want an array?  It looks more like an object pattern to me.  Where does this file come from?
Avatar of Member_2_5212910
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial