I have a set of textfiles containing personal data. I want to use a script to run through them and write them to a mysql database. What I have done so far is to read the text file into a string, explode the string at " " and then run through the array to find the required information. There are a couple of problems with that though, so maybe someone knows a better solution alltogether.
The base text file looks like this:
Name: Marius
Address 1: Street
Address 2: Town
Address 3: Country
etc
The problem in this is that I have no way of knowing how long the 'value' of i.e. Street is. Could be just the 'Somestreet' or 'Some Street' or 'Some Street 1337'. This goes for pretty much every field.
Is there maybe a method to turn that text into an array, where for every item the string ending with ":" is used as the key and every following item without ending ":" is considered the value?