<?php $lines = file("/tmp/file.txt"); foreach ($lines as $line) { $line = rtrim($line); print("$line\n"); # more statements... } ?>