0

Hi so i have a table created and it is to display the users age in column one, then in the second column half of the age and the last column is to display double the age. I know how to do this part, however the next part is to increment the users age by 10 and display these answers in the following row, then to increment the age by 20 and display the answers etc. I have no idea how i can increase the number. The way i have it done is creating new variables however it's alot of code and i was assuming there must be another way to do this. Can anyone tell me how to do this. here's the code for the table that i have.

$halfAge = $theAge / 2;
         $doubleAge = $theAge * 2;
         $plusTen = $theAge + 10;
         $halfTen = $plusTen / 2;
         $doubleTen = $plusTen * 2;

        echo "<table>";
        echo "<tr>";
        echo "<th>Age </th>";
        echo "<th> Twice Age </th>";
        echo "<th> Half Age </th>";
        echo "</tr>";
        echo "<tr>";
        echo "<td> $theAge </td>";
        echo "<td> $doubleAge </td>";
        echo "<td> $halfAge</td>";
        echo "</tr>";
        echo "<tr>";
        echo "<td> $plusTen </td>";
        echo "<td> $doubleTen </td>";
        echo "<td> $halfTen </td>";
        echo "</tr>";
        echo "</table>";
2
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by laura301019
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.