Hi, I am trying to create a table chart, printing “*” correlating to a number in the array. I can get the display correctly horizontally, however I would like to create this as a vertical style. I cannot seem to get each column started correctly, if anyone could provide me with help, I would greatly appreciate it.
Thanks and regards,
jun
[php]$month = date(“n”); //numeric representation of month (1-12)
$year = date(“Y”); //4 digit representation of year
$day = date(“d”); //numeric representation of the day of the month
// constant variable to determine how many days alive according to the current date
define(‘DAYS_ALIVE’,(($year - 1902) * 365.24) + (($month - 1) * 30.5 )+ ($day - 1));
$divident = 100000; // variable for modulus
$divider = 10000; // variable to shrink the divident
for($i = 0; $i <= 4; $i++) // for loop to fill the array with days alive
{
$daysArray[$i]= floor((DAYS_ALIVE % $divident)/$divider); //calculates the single digit to store in array
$divident= $divident/10; //after every iteration the divident is decreased
$divider= $divider/10; //after every iteration the divider is decreased
}
echo "<table border='2' width='100%'>";
$arraySize = count($daysArray); //variable for the array size
for($k=0;$k<=$arraySize-1;$k++)
{
for($j=1;$j<=$daysArray[$k];$j++)
{
echo "<tr><td> * </td>";
}
echo "<tr><td>$daysArray[$k]</td>";
}
echo "</table>";[/php]
I would like to create something like this.