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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:24:59+00:00 2026-05-28T16:24:59+00:00

I can output data to a string or an array like following. And I

  • 0

I can output data to a string or an array like following. And I know the number of columns and rows. For example $numofrow is 6 and max $numofcol is 5 for this data.

Now what I am not sure is that how I can these to a table. Should I use the array? If so, how? Problem is that some rows have less number of data or td than others.

//as an array $mycriteria
array(6) {
  [0]=>
  string(64) "Criteron A-1,Criteron A-2,Criteron A-3,Criteron A-4,Criteron A-5"
  [1]=>
  string(64) "Criteron B-1,Criteron B-2,Criteron B-3,Criteron B-4,Criteron B-5"
  [2]=>
  string(51) "Criteron C-1,Criteron C-2,Criteron C-3,Criteron C-4"
  [3]=>
  string(38) "Criteron D-1,Criteron D-2,Criteron D-3"
  [4]=>
  string(64) "Criteron E-1,Criteron E-2,Criteron E-3,Criteron E-4,Criteron E-5"
  [5]=>
  string(51) "Criteron F-1,Criteron F-2,Criteron F-3,Criteron F-4"
}

//as a string $mycriteria
mycriteria: string(337) "Criteron A-1,Criteron A-2,Criteron A-3,Criteron A-4,Criteron A-5
Criteron B-1,Criteron B-2,Criteron B-3,Criteron B-4,Criteron B-5
Criteron C-1,Criteron C-2,Criteron C-3,Criteron C-4
Criteron D-1,Criteron D-2,Criteron D-3
Criteron E-1,Criteron E-2,Criteron E-3,Criteron E-4,Criteron E-5
Criteron F-1,Criteron F-2,Criteron F-3,Criteron F-4"

Update:

I really need to have empty td as you see below since I am using border lines. Without empty td, it looks ugly.

What I am looking for is the following HTML.

<table>
<tr>
<td>Criteron A-1</td><td>Criteron A-2</td><td>Criteron A-3</td><td>Criteron A-4</td><td>Criteron A-5</td>
</tr>
...
<tr>
<td>Criteron D-1</td><td>Criteron D-2</td><td>Criteron D-3</td><td></td><td></td>
</tr>
...

</table>
  • 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-28T16:25:00+00:00Added an answer on May 28, 2026 at 4:25 pm

    Since you want full rows, here’s another answer with that:

    array_walk($my_array,function(&$a) {$a = explode(",",$a);});
    echo "<table>";
    for( $y=0; $y<$numofrow; $y++) {
        echo "<tr>";
        for( $x=0; $x<$numofcol; $x++) {
            echo "<td>".$my_array[$y][$x]."</td>";
        }
        echo "</tr>";
    }
    echo "</table>";
    

    Required PHP 5.3. If you have lower replace the first line with:

    array_walk($my_array,create_function('&$a','$a = explode(",",$a);'));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to output some data to a file. For example assume I have
I have a DataSet consisting of XML data, I can easily output this to
in what way can I output the reference of an object in memory. Like:
I know this sounds like a broad question but I can narrow it down
I want to split a string that can look like this: word1;word2;word3,word4,word5,word6.word7. etc. The
I have simple output data in an array: $result = array ('status'=>true, 'message'=>123123); I
I can output a locale sensitive time format using strftime('%X') , but this always
can we output a .jpg image or .gif image in C? I mean can
How can I output all of the text in a node, including the text
How can the output rate be higher than hard disk write rate? Update 1

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.