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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:22:48+00:00 2026-05-26T14:22:48+00:00

<table> <tr <td align=center> <?PHP $b = 1; for ($a=1; $a<=1; $a++) { echo

  • 0
<table>
<tr
<td align="center">
<?PHP

$b = 1;
for ($a=1; $a<=1; $a++)
{
    echo $b++;
    echo "<br>";
}

$b = 2;
for ($a=1; $a<=2; $a++)
{
    echo $b++;

}

echo "<br>";
$b = 4;
for ($a=1; $a<=3; $a++)
{
    echo $b++;

 }
echo "<br>";
$b = 7;
for ($a=1; $a<=5; $a++)
{
    echo $b++;

{
echo "<br>";
$b = 12;
for ($a=1; $a<=5; $a++)
{
    echo $b++;

}
echo "<br>";
$b = 17;
for ($a=1; $a<=4; $a++)
 {
     echo $b++;

}
echo "<br>";
$b = 21;
for ($a=1; $a<=3; $a++)
{
    echo $b++;

}
echo "<br>";
$b = 24;
for ($a=1; $a<=2; $a++)
{
    echo $b++;

}
echo "<br>";
$b = 26;
for ($a=1; $a<=1; $a++)
{
    echo $b++;

 }

 ?>
 </td>
 </tr>
 </table>

I am trying to use for loops to make a shape that looks something along the lines of this:

I have managed to do it, but using way too many loops (9), I want to be a little less than this. Anyone have any help?

P.S its meant to be a diamond shape with the numbers 1-26

   ![sort of like this][1]     
  • 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-26T14:22:48+00:00Added an answer on May 26, 2026 at 2:22 pm

    How about:

    $arr = array(1,2,4,7,12,17,21,24,26,27);
    for($i=1; $i<count($arr); $i++) {
        for($j=$arr[$i-1]; $j<$arr[$i]; $j++) {
          echo $j;
        }
        echo "<br>";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

To vertically-center align text in a table-cell, I use vertical-align: middle in the td
Consider the task of replacing this table with CSS stylings: <table border=1> <tr><td align=center>
I just started to use PHP Simple HTML DOM Parser . Now I'm trying
I'm trying to use php with mysql. basically i've an index page where user
I'm trying to display/echo html code text as it is in php. I tried
I'm trying to send an email to myself that has a layout and images.
I have been trying to figure out a way to make this work, but
I have a table that displays months(Jan through Dec) in a table as follows.
I've got an inventory table that needs to have certain in each row, and
I create a table using PHP from a database, meaning the size of the

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.