$fp = fopen('test.txt', "r");
flock($fp, LOCK_EX);
while (($a = fgets($fp)) !== false) {
echo "<pre>";
var_dump($a);
echo "</pre>";
}
flock($fp, LOCK_UN);
fclose($fp);
$fp = fopen('test.txt', "r");
flock($fp, LOCK_EX);
while (($a = fgets($fp)) !== false) {
echo "<pre>";
var_dump($a);
echo "</pre>";
}
flock($fp, LOCK_UN);
fclose($fp);