02-20-2013, 11:34 PM
So, using numbers in php is very easy. Remember though coding always starts from 0 not one.
So to add lets say 1 + 1 you'd do it like this.
This would just echo out "2" that's all.
Lets say if you'd like to multiple 5 by 5 you'd do it like this.
See I am using * to multiple it, and not a x. But all this will echo out is "25".
There are a lot more witch you should be able to work out on your own.
Note: If you need any help and I have not yet made a tutorial for it please visit php.net.
So to add lets say 1 + 1 you'd do it like this.
PHP Code:
<?PHP
$number1 = 1;
$number2 = 1;
$number3 = $number1 + $number2;
echo $number3;
?>
This would just echo out "2" that's all.
Lets say if you'd like to multiple 5 by 5 you'd do it like this.
PHP Code:
<?PHP
$number1 = 5;
$number2 = 5;
$number3 = $number1 * $number2;
echo $number3;
?>
See I am using * to multiple it, and not a x. But all this will echo out is "25".
There are a lot more witch you should be able to work out on your own.
Note: If you need any help and I have not yet made a tutorial for it please visit php.net.