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>

Edited by loren646
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.