My possible friends are:

foreach($array as $x) echo $x."
"; //construct output string based on inputs echo "

My random friend is ".$array[$f-1]." ".$l."

"; fclose($file); //close file ?>