Показать выпадающий список

fgets()

« fgetcsv | fgetss »
<?php
// loads some data in a temp file
file_put_contents(
    
"/tmp/pbe.txt",
    
 // mixed $data
);

$count =
    
// int $count

$handle fopen("/tmp/pbe.txt""r");

for (
$i 0$i $count$i++) {
    
fgets($handle);
}

$string fgets (
    
// resource $handle
    
  // [int $length]
);
?>
Результат
$string = 'third line
'
Примеры
#1 fgets  (/* $data = "first line second line third line fourth line fifth line" */
 /* $count = 2 */
 /* $handle = $handle */
)
#2 fgets  (/* $data = "first line second line third line fourth line fifth line" */
 /* $count = 1 */
 /* $handle = $handle */
 /* $length = 11 */
)
#3 fgets  (/* $data = "first line second line third line fourth line fifth line" */
 /* $count = 5 */
 /* $handle = $handle */
)
См. также
fgetc, fgetss, fread