I've got a txt file that contains something like this:
This is what i would like to create an array from. So the first key would be ['blue_red'] with a value "chips_chocolate"."blue_red" => "chips_chocolate", "orange_yellow" => "bananas_grapes", "pink_green" => "cakes_biscuits",
Is there a way to do this?
I tried
Code: Select all
$array = array (file_get_contents('arraycontents.txt'));
print_r($array);It's just taking the entire lot as key[0].Array ( [0] => "blue_red" => "chips_chocolate", "orange_yellow" => "bananas_grapes", "pink_green" => "cakes_biscuits", )
Thanks