DevelopPHP
home Forum gear home

Libraries book

HTML Library CSS Library JavaScript Library PHP Library

Videosbook

PHP and MySQL JavaScript HTML and CSS Vector and 3D Flash Actionscript Android Dev Miscellaneous

Resourcesbook

Website Hosting
Arithmetic Operators in PHP   Share / Like
PHP can perform simple mathimatical operations all the way to complex trigonometric equations. The operator symbols used all make good sense for the mathematical action they perform.

Here are the arithmetic symbols and how to apply them in the most basic way:
Learn HTML
<?php
// Set a couple of sample integer variables
$var1 5;
$var2 3;
// Addition >>> Sum of $var1 and $var2
echo $var1 $var2;
echo 
"<br />";
// Subtraction >>> Difference of $var1 and $var2
echo $var1 $var2;
echo 
"<br />";
// Multiplication >>> Product of $var1 and $var2
echo $var1 $var2;
echo 
"<br />";
// Division >>> Quotient of $var1 and $var2
echo $var1 $var2;
echo 
"<br />";
//Modulus >>> Remainder of $var1 divided by $var2
echo $var1 $var2;
echo 
"<br />";
//Negation >>> Opposite of $var1
echo -$var1;
?>

Develop PHP browser display window
8
2
15
1.66666666667
2
-5



Home   •   Terms of Use   •   Developer Forums   •   T-Shirts   •   RSS   •   Classroom Chalkboard   •   Donate   •   Top ↑
Popular In PHP / MySQL E-Commerce Store Production
Social Network Website Building
Image Upload / Photo Processing
CMS Software Programming
Mass Email Systems
Magic XML Data
Search Programming
Popular In JavaScript JSON Programming
Ajax Programming
Animating Elements
WYSIWYG Programming
Date/Time Programming
DOM Scripting
Object Reference
Popular In HTML Canvas Element
New Form Elements
Audio Element
Video Element
Drag and Drop
Event Handling
Element Grouping
Popular In CSS Custom Font Embedding
Dynamic Fit Backgrounds
Theatre Mode
Box Overlays
CSS Level 1 Properties
CSS Level 2 Properties
CSS Level 3 Properties
©2013 DevelopPHP   |   Navigate to related domains HTML5