If each line is just one line, then using file() might be easier since it places the file into an array, one line per entry. Then you can split or use preg_match() (or eregi) to build that array into the array you want.
Since a file() array has the new line character attached, I would use preg_match() with an ending modifier ($) to cut the new line character off.
I just wipped this up, but it should get you started:
$file = file('filename.txt');
$filearray = array();
foreach ($file as $line) {
if (preg_match('/^([0-9]+)\|(.+)$/', $line, $matches)) {
$filearray[$matches[1]] = $matches[2];
}
}
If you are not familiar with regular expressions, then I can try to explain the meaning of "/([0-9]+)|(.+)$/" to you if you want.