Processing variable-length text fields
<?php
$delim = '|';
$fh = fopen('books.txt','r') or die("can't open: $php_errormsg");
while (! feof($fh)) {
$s = rtrim(fgets($fh));
$fields = explode($delim,$s);
}
fclose($fh) or die("can't close: $php_errormsg");
?>
Related examples in the same category