Jump to content

Execution order - incorrectly - Should be simple?!


loren646

Recommended Posts

The table should be at the top but instead the table is below the do statement. Shouldn't the program start from the top and work it's way down?

 

OUTPUT: (basically the TABLE is in the wrong place)

 

http://testingrentals.hostei.com/test.php

 

CODE BELOW:

 

<html>

<body>

<?php

 

echo "<table border='0' cellpadding='3'>";

echo "<tr>";

echo "<td bgcolor='#CCCCCC' align='center'>Distance</td>";

echo "<td bgcolor='#CCCCCC' align='center'>Cost</td>";

echo "</tr>";

$distance = 50;

while ($distance <= 250)

{

echo "<tr>\n <td align='right'>$distance</td>\n";

echo " <td align = 'right'>".$distance / 10 ."</td>\n</tr>\n";

$distance += 50;

}

echo "</tables>";

 

echo '<p>';

$num = 100;

do

{

echo $num.'<br>';

$num += 50;

}

while ($num<350);

 

?>

</body>

</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.