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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:02:01+00:00 2026-06-11T20:02:01+00:00

Have been working on a small project, and have gotten stuck at a part

  • 0

Have been working on a small project, and have gotten stuck at a part that I am trying to get working. Not sure if I am taking the wrong type of approach for it, and there is a better way, but here we go.

I have data in a text file that is written and read to.
example: (values are separated by a \t)

S1684    This is a status    share   20/9/2012           share;

What I am doing is searching the file, and returning anything that matches as a part of the array. I have the search working fine, and can return each line that contains the search query, only problem is exploding the results so that I can properly format what I return. This is the main chunk that deals with it.

if(preg_match_all($pattern, $data, $matches)){
       echo "<h3>Results:</h3>";

       echo implode("<p>\r\n", $matches[0])."</p>";

       foreach ($matches as &$value) {
        $date =0;
         list($statusCode, $status, $share, $date, $like, $comment, $share) = explode("\t", $date);

         echo "<h4>Status:".$status."</h4>";
         echo "<h4>Status Code:".$statusCode."</h4>";
       }

    }

The error I receive are undefined offset errors, so how exactly would I be able to explode (or split the array result in any other way) to echo it properly?

Any help is much appreciated thanks.

  • 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-06-11T20:02:02+00:00Added an answer on June 11, 2026 at 8:02 pm

    Shouldn’t it be explode("\t", $value); instead of explode("\t", $date);

    You are using $value for holding the current value of the array during iteration. $date is always being assigned 0 in the iteration, and trying to explode it will be causing the error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small c++ project I've been working on in XCode, that I'd
I have a small open source OSX project I've been working on that I'd
I have been working on a small project on recent delived ASP.NET MVC 3
I have been working with a small team on a small project about fiction
I have this small project I have been working on. I have a MySQL
I have been working on a small file manager module in a project where
I have been working on a C++ project that uses SDL, and wonder if
I've been working on a small project that consists of a GUI with a
I have been working with a small project recently which involves Struts 2 and
I'm new to C# and I've been working on a small project to get

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.