PHP Math functions for addition, subtraction, multipication & 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.
echo $c;
Now try a subtraction.
echo $c;


echo $c;


echo $c;
The output of division can be formatted to required decimal places
Visitors Rating
Your Rating




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>";

Post Comment This is for short comments only. Use the forum for more discussions.

HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us
©2000-2017 All rights reserved worldwide Privacy Policy Disclaimer