here is the code:
<html>
<head>
<title>Operation in PHP script</title>
</head>
<body>
<?php
$number1 = 13;
$number2 = 27;
$total = $number1 + $number2;
$connect_text = 'The total of two variables = ';
print ($connect_text . $total);
?>
</body>
</html>
<head>
<title>Operation in PHP script</title>
</head>
<body>
<?php
$number1 = 13;
$number2 = 27;
$total = $number1 + $number2;
$connect_text = 'The total of two variables = ';
print ($connect_text . $total);
?>
</body>
</html>
then,let us take a look on this line :
$total = $number1 + $number2;
here ,we got 3 variables ,1 '=' and 1 '+'.so this plus symbol(+) is function to add the variables.
plus it also can be like this:
print(10+20+30);
print($number1+10+$number2);
well,just try change '+' with other operation symbol like subtract(-),divide(/) and multiply(*).then take this line:
$total = $number1 + $number2;
change it to be like this:
$total = $number1 + ($number2-$number3);
/*remember...to declare first the variable '$number3' and already put the value in that variable*/
N/NOTE:Well,just explore it by urself,if got some problem,please comment me...
--->operation in PHP is piece of cake !<---
No comments:
Post a Comment