Answers for "php read line 1 fopen"

PHP
5

php read file line by line

$handle = fopen("inputfile.txt", "r");
if ($handle) {
    while (($line = fgets($handle)) !== false) {
        // process the line read.
    }

    fclose($handle);
} else {
    // error opening the file.
}
Posted by: Guest on May-22-2020
0

readline php

<?php
 
// For input
// Hello World
$a = readline('Enter a string: ');
 
// For output
echo $a;   
?>
Posted by: Guest on April-10-2022

Browse Popular Code Answers by Language