I have a .txt file that has the following details:
ID^NAME^DESCRIPTION^IMAGES 123^test^Some text goes here^image_1.jpg,image_2.jpg 133^hello^some other test^
Ok, didn't see the edited version, so here's a redo. It's most likely a CSV file that uses carets as the separator, so...
$fh = fopen('yourfile.txt'); $headers = fgetcsv($fh, 0, '^'); $details = array(); while($line = fgetcsv($fh, 0, '^')) { $details[] = $line; } fclose($fh);