Question: PHP - Load Associative Array with text file Text file is delimited by | The Key names are: CODE|Description|Price|PartNumber text file sample: TIR|Tires|100|P2345 SPK|Spark Plugs|25|P6543
PHP - Load Associative Array with text file
Text file is delimited by "|"
The Key names are: CODE|Description|Price|PartNumber
text file sample:
TIR|Tires|100|P2345
SPK|Spark Plugs|25|P6543
AXL|Axle|2000|P9087
OIL|Oil|15|P4265
The associative array would look like this:
Product = array(
array(
"CODE"=>"TIR",
"Description"=>"Tires",
"Price"=>100,
"PartNumber"=>"P2345"
),
array(
"CODE"=>"SPK",
"Description"=>"Spark Plugs",
"Price"=>25,
"PartNumber"=>"P6543"),
array(
"CODE"=>"OIL"
"Description"=>"Oil"
"Price"=>15
"PartNumber"=>"P4265")
);
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
