A newbie to php but trying learn.
I thought it might be best to learn by trying to create small simple programs but I am getting the following error:

Parse error: syntax error, unexpected T_STRING in /home/jctest/www/www/mytest/mortgage.php on line 8

the code where the error seems to be is as follows:

<?php
// Set up variables
$month = 1;
$balance = 60834.09;
$payment = 573.81;
 
//Calculate interest 
function calcInterest() {                   <-----------[B] This is Line 8[/B]
$interest = ($balance x 6) / 100;
$balance = $balance + $interest;
echo $balance;
}
 
//Deduct Bi-weekly payment
Function calculate(){
$balance = $balance - $payment;
}
 
// Do calculation
calculate();
echo $balance . "<br>";
calcInterest();
echo $balance . "<br>";
?>

Any help appreciated.

Thanks

Puckdropper commented: Thanks for noting the line where the error is. +4

Recommended Answers

All 2 Replies

Acutally, this is line 8:

$interest = ($balance x 6) / 100;

and you need to use * for multiplication instead of 'x'.

Yes of course. How stupid am I? :(

Thank you very much. Very much appreciated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.