For statement with table

I’m trying to create a table of Fahrenheit and Celcius degrees using a for statement, however I cannot get the column rows and #'s to show up accurately. Tried several ways and cannot figure it out for the life of me!

The left column should display 0-250 degrees increasing and the right column should display the celcius degree increasing.

Here’s the code I have:

[php]<?php

$tempFahrenheit = 0;
$tempCelcius = (5/9)*($tempFahrenheit -32);

for ($tempFahrenheit; $tempFahrenheit <= 250; $tempFahrenheit++)
for ($tempCelcius; $tempCelcius <= 121.11; $tempCelcius++)

{
print("

" . “$tempFahrenheit &degF” . “ ” . “$tempCelcius &degC” . “ ”);
}
?>[/php]

First, think about what you are doing. Why do you need two for loops?

Second, where is the rest of your table?

I gather you want it to look something like this?

Here’s how to do it in jQuery :https://jsfiddle.net/Strider64/ckfjLz50/
[size=14pt]***** SPOILER ALERT *****[/size]

Doing something like this in PHP would be basically the same principal when it comes to the for loop.

Sponsor our Newsletter | Privacy Policy | Terms of Service