Assuming the file fits in memory, this is fine, but you're method will fail if you go over the memory limit.
The way I do it:
<?php
$filename = "myfile.txt";
$fp = fopen($filename,"r");
while (!feof($fp)){
$row = fgets($fp,100000);
$pieces = split("\n", $row);
insert_function($pieces);
}
?>
This method will work for very large files (hundreds of megs) without running php out of memory.