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 6055351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:15:18+00:00 2026-05-23T08:15:18+00:00

I have this txt file structure: data;data;data;#;my data;my data;my data data;data;data;#;my data;my data;my data

  • 0

I have this txt file structure:

"data";"data";"data";#;"my data";"my data";"my data"
"data";"data";"data";#;"my data";"my data";"my data"
"data";"data";"data";#;"my data";"my data";"my data"

I need to read this file data just after the # sign.
My PHP code just for read the entire line.

$file_handle = fopen("texto.txt", "r");
$numlinha = 0;
while (!feof($file_handle)) {
   $line = fgets($file_handle);
   $numlinha++;
   echo $numlinha . ". " . $line . "</br></br>";
}
fclose($file_handle);
  • 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-23T08:15:19+00:00Added an answer on May 23, 2026 at 8:15 am

    You can use strpos function to find position of first # char in your line.

    $file_handle = fopen("texto.txt", "r");
    $numlinha = 0;
    while (!feof($file_handle)) {
       $line = fgets($file_handle);
       $cpos = strpos($line, '#');
       if ($cpos !== FALSE) {
           $line = substr($line, 0, $cpos);
       }
       $numlinha++;
       echo $numlinha . ". " . $line . "</br></br>";
    }
    fclose($file_handle);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I have a text file (data.txt), It's a story, so just sentence after
OK. For example I have this line in my txt file: 1|1,12;7,19;6,4;8,19;2,2 As you
I have to read a txt file with lines formated like this: 1: (G,
I have this file file.txt which I want to split into many smaller ones.
I have a CMakeLists.txt file that looks like this: add_executable(exec1 exec1.c source1.c source2.c source3.c)
I have a generated txt file. This file has certain lines that are superfluous,
I'm creating a Shell Script, and I have a file like this called expressions.txt
I have a file like this. rm a.txt mkdir foo cp a.doc docs I
Let's say you have a text file like this one: http://www.gutenberg.org/files/17921/17921-8.txt Does anyone has
i have tried this: <?php $fileip = fopen(test.txt,r); ?> this should have opened the

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.