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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:05:51+00:00 2026-06-09T22:05:51+00:00

$filename = ‘itunes_report.txt’; $f = fopen($filename, ‘r’); $db = array(); $dbSize = 0; $var

  • 0
$filename = 'itunes_report.txt';
$f = fopen($filename, 'r');
$db = array();
$dbSize = 0;

$var = file($filename);
$mydata = trim($var[1]);
$temp   = explode(" ", $mydata);
print_r($temp);

i read data from a file using this code. i was take the first line from the text file.
this is the line

APPLE   US  ebookReaderipad EC Media (International) Pvt. ltd   BooksOnwink 1.3 1F  1   0   07/30/2012  08/05/2012  GBP GB  GBP 425105344   0

i explode this line using white spaces. Then some white spaces are missing in output.
out put

Array ( [0] => APPLE    US  ebookReaderipad EC [1] => Media [2] => (International) [3] => Pvt. [4] => ltd   BooksOnwink 1.3 1F  1   0   07/30/2012  08/05/2012  GBP GB  GBP 425105344   0 )
  • 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-09T22:05:53+00:00Added an answer on June 9, 2026 at 10:05 pm

    Your input seem to be is tab \t delimited, you can split on "\t":

    $temp = explode("\t", $mydata);
    

    or if you are really mean to split on every whitespace, try using a more flexible spit with regexps:

    $temp = preg_split('/\s+/', $mydata);
    

    This will split on everything considered whitespace and consume sequence of whitespaces too.

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

Sidebar

Related Questions

char *loadTextFile(const char *filename) { FILE *fileh; char *text = 0; long filelength; if((fileh=fopen(filename,rb))==
I tried to get filename from uploaded file with WebImage like so: var imageName
string fileName = test.zip; string path = c:\\temp\\; string fullPath = path + fileName;
function getHtmlBodyFromFile( filename ){ var outStr = ''; $.get(filename, function(data, status) { outStr =
I use fopen(filename.c_str(), rb); in Qt with images resources. But fopen wants a full
For example: S1: some filename contains few words.txt S2: some filename contains few words
Possible Duplicate: Getting Filename from file descriptor in C Obtain filename from file pointer
How to open a filename given in Main's argv[] (say, D:\a.txt) by CreateFile API?
Given a filename in C, I want to determine whether this file exists and
i have filename according to this file name. i need to find file's path.

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.