PHP :: Extract data from text file?

\ ReLiGuLoUs //

New member
I have text.txt file which has;

Column A | Column B

123 | one two three
456 | four five six
789 | seven eight nine

The script pulls each line at random, and then splits the two columns to be used separately.
the first column has the variable $A and second variable $B

How can I do this?
I already know how to pull out each line at random but can't figure out how to separate the two pieces in the line.. BTW it doesn't essentially need to be columns in the text file it was just to show what I wanted..

pull data randomly from each line script ::
$location = '/text.txt';
$data = file($location);
$line = trim($data[array_rand($data)]);

THank you for all your help.
More info.
$line would show the whole line..
 
Back
Top