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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:29:00+00:00 2026-05-28T18:29:00+00:00

I hope I can make this question clear enough. I’m looking to put a

  • 0

I hope I can make this question clear enough.

I’m looking to put a list of arrays inside one master array, dynamically, so that it looks like this:

masterarray { 
array1 
{ [0]=>VAL1 [1]=>VAL2 } 
array2 
{ [0]=>VAL1 [1]=>VAL2 }
array3 
{ [0]=>VAL1 [1]=>VAL2 }
}

I’ve tried, but I could only get it to look like this:

array(1) { [0]=> array(2) { [0]=> string(1) "1" [1]=> string(13) "CODE" } } 
array(2) { [0]=> array(2) { [0]=> string(1) "1" [1]=> string(13) "CODE" } [1]=> array(2) { [0]=> string(1) "1" [1]=> string(13) "CODE" } } 
array(3) { [0]=> array(2) { [0]=> string(1) "1" [1]=> string(13) "CODE" } [1]=> array(2) { [0]=> string(1) "1" [1]=> string(13) "CODE" } [2]=> array(2) { [0]=> string(1) "1" [1]=> string(13) "CODE" } }

And that’s definitely not what I’m aiming for. Nothing seems contained. I need the format specified above.

I’m using the explode function on a string pulled from a file to make this table of arrays (I think you call it that)

Here is the code I’m using that’s not working.

$variabledebugging = file("FILE.TXT");//LOOK IN THIS FILE FOR THE NUMBER AND SET IT TO A VAR.
$i=0;
foreach($variabledebugging as $placeholder){
$variabledebuggingtbl[] = explode("\t",$variabledebugging[$i]);
var_dump($variabledebuggingtbl);
$i++;
}

I’ve tried a couple of different variations, but that’s the one I’m using now.

To be clear, that file being pulled (each line as a value in an array) has 2 things written to each line, separated by a tab character, so that’s the system I’m going on.

Thank you! I’m sure this is a simple task, I just can’t think it through.

Oh and while I’m at is there a way to make debugging more readable?

  • 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-28T18:29:01+00:00Added an answer on May 28, 2026 at 6:29 pm

    You ARE getting the right result. The reason it seems wrong is that you are running var_dump inside the loop. And why don’t you use the $placeholder variable?

    $variabledebugging = file("FILE.TXT");
    foreach($variabledebugging as $placeholder){
      $variabledebuggingtbl[] = explode("\t", $placeholder);
    }
    var_dump($variabledebuggingtbl);
    

    I’m not sure what you mean by “making debugging more readable”, but if you want some linebreaks and indentation you should just look in the generated HTML code. var_dump do add spacing to make it readable but it is ignored by the web browser. If you don’t want to read the HTML source, just add your var_dump to a <pre> element.

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

Sidebar

Related Questions

I hope I can make myself clear in English and in what I want
I hope I can explain this clearly enough. I have my main form (A)
my SQL skills aren't strong enough to figure this out, hope someone can help.
I hope this is a simple question. Can I inherit both an abstract class
Is there any way (utilizing Reflection I hope) that I can make an instantiated
Hope anyone can shed light on this so I can use pens with dash
I hope you can help. This has been confounding me for hours. I have
I hope someone can help me with this, as I'm unable to find the
I would be very glad if someone can make clear for me example mentioned
Update: I can't delete this question, because the answer has been upvoted, yet it

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.