Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to reads a file into an array ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 163
    Comment on it

    Hi Reader's,
    Welcome to FindNerd, today we are going to discuss how to reads a file into an array ?

    If you want to read a file into an array then, you should use file() function.This function reads a file into an array.
    syntax of file() function

     file(path,include_path,context);
    

    So there are 3 main parameter of above syntax
    1-path is a required parameter.
    2-include_path and context both are optional parameter

    you can see below example:

     <?php
        //here call file() and print your file
        print_r(file("file.txt"));
    ?>
    

    The output of the code above will be: Array ( [0] => Hi all welcome to findnerd )

 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: