PHP Math functions for addition, subtraction, multiplication & division
Simple PHP functions to handle addition , subtraction , multiplications and divisions can be done by using built in functions.
Best way to learn is to develop some sample scripts.
Here are some of them.
Let us start with simple addition of two variables storing numbers.
Now try a subtraction.
echo $c;// output 42
The output of division can be formatted to required decimal places
echo $c; //Output 0.21428571428571
Modulus : remainder of a math division
Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
|What is the value is not given, or not been initialize? Then what if i want to display my answer in textbox? Any idea?|
|Textbox value can be connected to display variable $c|
echo "<input type=text name=t1 value=$c>";