I have a file like below, which I need to convert into an array:
ABCLine, Number, One DEFNumber, Two, Line GHIThree, Line, Number
I can get each line and turn it into a value of an array, but what I need to do is take the first 3 characters and turn that into a key and then the rest of the line into the value.
So my expected array would be:
Keys | Values
----------------------------
ABC | Line, Number, One
DEF | Number, Two, Line
GHI | Three, Line, Number
I honestly am not too sure where to begin, I've been looking all over and haven't been able to find a way to just take those first 3 characters and turn those into a key for the remainder of the line.
I started with some code, which looks like this:
<?php
echo "Name<br/>";
$file = "hw3.txt";
$f1 = fopen($file, 'r');
$array = array();
?>