MOTOSHARE 🚗🏍️

Rent Bikes & Cars Directly from Owners

Motoshare connects vehicle owners with people who need bikes and cars on rent. Owners earn from idle vehicles, and renters get flexible ride options.

Visit Motoshare

Tutorial for fread() in Reading file

php

What is fread()?

The file’s data is read using the PHP fread() function. Two parameters are required: file resource and file size.

Read the File using fread()

Using the fread() method, we may read content from an already open file. There are two parameters to the fread() function:

  • first is the filename
  • and the second argument specifies the size in bytes for the content to be read.

Example:-

Let’s take an example, if we have a file studytonight.txt with following content:

Studytonight is for coding enthusiasts!

If we wish to read the file’s complete content, we’ll open it in read mode and then use the fread() method.

Output:-

Ashwani Kumar
Latest posts by Ashwani Kumar (see all)
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x