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

  • Home
  • SEARCH
  • 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 6751797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:58:10+00:00 2026-05-26T12:58:10+00:00

How do I get my array to display correctly with column headers and values?

  • 0

How do I get my array to display correctly with column headers and values? Should I convert the array to a string first somehow? But then how do I get it to display right with columns and rows?

I’m getting data from a CSV file sent to an array called $data.

$data = curl_exec($ch);

When I echo the $data it looks like this…

    CODE: 

echo $data[0];
echo $data[1];
echo $data[2];
echo $data[3];
echo $data[4];
echo $data[5];
echo $data[6];
echo $data[7];
echo $data[8];
echo $data[9];
echo $data[10];
echo $data[11];
echo $data[12];
echo $data[13];
echo $data[14];
echo $data[15];
echo $data[16];
echo $data[17];
echo $data[18];
echo $data[19];

OUTPUT:

“number”,”priority”,

As you can already tell 0=”, 1=n, 2=u, 3=m 4=b, 5=e, 6=r, 7=”, 8=, etc. “number”,

  • 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-26T12:58:10+00:00Added an answer on May 26, 2026 at 12:58 pm

    The CSV file is returned as a string, so accessing $data[1] is the same as substr($data,1,1). The simplest way for you to do this would be to save it to a file and then use fgetcsv:

    file_put_contents('tmp.csv',$data);
    $row = 1;
    if (($handle = fopen("tmp.csv", "r")) !== FALSE) {
        while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
            $num = count($data);
            echo "<p> $num fields in line $row: <br /></p>\n";
            $row++;
            for ($c=0; $c < $num; $c++) {
                echo $data[$c] . "<br />\n";
            }
        }
        fclose($handle);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get a pie chart display correctly but have found there
How can I get an array of values from an associative array ? Associate
I have an array of values being made available, but unfortunately some of the
How in C++ get array length with pointers only ? I know that tab
Is there a simple way to get array of all index paths for the
Please tell me how can I get array of all Those DIV of specific
Which one below is correct? First code has no quotes in the $_GET array
get an array of bluetooth ID's Broadcast the bluetooth signal manually
How do I get this array: Array ( [0] => Array ( [max] =>
I am trying to get an array of a date plus the next 13

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.