Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6078495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:50:25+00:00 2026-05-23T10:50:25+00:00

How to insert some text middle of the file in php, is that ay

  • 0

How to insert some text middle of the file in php,
is that ay method available to insert text in middle of file content.

not exactly middle of the file.,
search a keyword, then we need to insert before or after the content,

if the search keyword found more than one time in file, then wat would be happen

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:50:25+00:00Added an answer on May 23, 2026 at 10:50 am

    Using fopen, fseek, ftell, fwrite, and fclose:

    // Create the file handler
    $file = fopen("filename", "r+");
    // Seek to the end
    fseek($file, SEEK_END, 0);
    // Get and save that position
    $filesize = ftell($file);
    // Seek to half the length of the file
    fseek($file, SEEK_SET, $filesize / 2);
    // Write your data
    fwrite($file, "Data");
    // Close the file handler
    fclose($file);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page and I want to insert 'Some text' on that page,
I want to make simple java program that will insert some text into current
I need to insert a Box containing some text that appears between the grid
I have a textarea and among free text input I insert some tags that
Im trying to insert some text that a Label has, and it wont insert
I'm using an HTML snippet to insert some text into the element, then display
I'm trying to insert some text midway through some HTML content using the following
I am trying to insert some text data into a table in SQL Server
I have problem when I try insert some data to Informix TEXT column via
Use case: I've just entered insert mode, and typed some text. Now I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.