Andrew, > unset ($filearray, $no, $line, $s); > Is there any reason you are unsetting the "filearray" variable? That is the main looping variable and can be left alone. You can actually leave this line altogether, PHP does automatic garbage collection. Shashank