Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • What is the use of fgets() in PHP ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 137
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: