Member_2_5212910
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.
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"
}
Are you sure you want an array? It looks more like an object pattern to me. Where does this file come from?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.