Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

printing a formatted multiplcation table

Posted on 2008-10-06
Last Modified: 2013-12-13
I want write a PHP code to print multiplication table with a certain format. attached is the format i want.

how it works--You have two cells spanned together and the result of those two are are multiplied with the column. this will give you the X like structure in the table.

I have included a code that will only print a multiplication table without that format.
<TITLE>A division table</TITLE>
<P>Please enter the matrix
<input type ="text"; size=5; name="end_num" VALUE="<?php echo $_POST['end_num']; ?>">
<H2>A division table</H2>
  print("\t<TH> </TH>\n");
  for ($row = $start_num; $row <= $limit; $row++)
  for ($row = $start_num; $row <= $limit; $row++)
    for ($column = $start_num; $column <= $limit; $column++)
        $result = $row * $column;
        printf("\t<TD>%.3f</TD>\n",$result);  // see Chapter 8
  //  print("</TR>\n");

Open in new window

Question by:Atouray
  • 2

Author Comment

ID: 22653270
still no one can contribute,

Expert Comment

ID: 22656378
May you please clarify what problem you are encountering?  I just inputted two sample variables:


And it generates your multiplication matrix just fine....

Accepted Solution

AdiF earned 500 total points
ID: 22656387
Oops sorry I see your file attachment now.....

I don't understand what you are trying to do by doing a colspan on some <TD>'s..... because 2x2 is not the same as 2x3......

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Detect Closed Loops (circles, figure-8s, etc) in PNG Images 6 56
How to fix Datetime in MySQL? 4 48
Number of reviews not counting correctly 2 22
Wordpress Query 5 25
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question