Hi Reader's,
Welcome to FindNerd, today we are going to discuss what is the use of fgets in PHP ?
Firstly let us know what is fgets()
The fgets() function is used to return a line from an open file.
syntax of fgets()
fgets(file,length)
you can see belloe example
<?php
//here define a testfile variable and call file.txt page and use fopen()
$testfile = fopen("file.txt","r");
//here call fgets()
echo fgets($testfile);
//here call fclose() function
fclose($testfile);
?>
0 Comment(s)