SQL PHP HTML ASP JavaScript articles and free scripts to download
 

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.

$a=5;
$b=6;
$c=$a+$b;
echo $c;

Now try a subtraction.

$a=8;
$b=10;
$c=$a-$b;
echo $c;


Multiplication
$a=3;
$b=14;
$c=$a*$b;
echo $c;

Division
$a=3;
$b=14;
$c=$a/$b;
echo $c;


The output of division can be formatted to required decimal places

Discuss this tutorial at forum


PHP Math Functions
PHP Math Functions  |Addition Subtraction  |Maximum and Minimum numbers  |PHP Round  | Random number generator  | NUmber Formatting  | Ceil and floor value of a number  | Modulus or reminder

 

Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.

Scripts
PHP
JavaScript
PHP Tutorials
Math Functions
PHP Sections
PHP Introduction
Loops & structure
Array
Date & Time
Functions
Form Handling
File Handling
Math Functions
String Functions
GD Functions
Comment Posting
Content Management
PHP & Ajax
Popular Tutorials
Drop down list
File Upload
Signup script
Member Login
Line Graph
PHP MySQL Paging
PHP Calendar
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.