Well, there's a few ways to go about it. The absolute easiest is like this:
$sFilePath = "/path/to/file";
$aFile = file($sFilePath);
But you'll need to strip newline characters with this method, so you do this:
$sFilePath = "/path/to/file";
$iId = "3"; // Set the id you're looking for
$aFile = file($sFilePath);
// Loop through the array
foreach($aFile as $Key=>$Value) {
// explode the line into another array - use the trim function to strip the newlines
$aRow = explode("|", trim($Value));
if($aRow[0] == $iId) {
// If the id is the same as the Row ID, set it to the result var
$sResult = $aRow[1];
break; // Break out of the foreach loop
}
}