[insert_php]
echo ‘
‘;
$sample_returns = ‘
Sample Annual Returns from 1/2/1970 – 12/30/2016 or earliest date available for stock.
MO = 20.11; AAPL = 16.80; KO = 14.04; S&P 500 = 7.58′;
if(isset($_POST[‘submit’])) {
echo ‘
‘;
echo $sample_returns;
$start_amount = $_POST[‘start_amount’];
$perc_increase = $_POST[‘perc_increase’]/100;
$years = $_POST[‘years’];
$cont_years = $_POST[‘cont_years’];
$annual_amount = $_POST[‘annual_amount’];
$x = 1;
setlocale(LC_MONETARY, ‘en_US’);
/* Print table header */
echo “
Year | Beginning Amount | Investment Gains | Annual Contributions | Ending Amount | Hourly Rate (Investment Gains) |
---|---|---|---|---|---|
$x | ” . money_format(‘%#20.0n’, $start_amount) . “ | ” . money_format(‘%#20.0n’, ($start_amount * $perc_increase)) . “ | ” . money_format(‘%#20.0n’, ($annual_amount)) . “ | ” . money_format(‘%#20.0n’, (($start_amount * (1 + $perc_increase)) + $annual_amount)) . “ | ” . money_format(‘%#20.2n’, (($start_amount * $perc_increase)/2080)) . “ |
“;
}
else {
echo ‘
‘;
echo $sample_returns;
}
[/insert_php]