Develop PHP Website for Learning Web Design Free Online
  Home   |   Forums   |   DevCMS
  Join   |   Log In
 
   

PHP Tutorials - Learn PHP

Tutor at Develop PHP
Arithmetic Operators in PHP
By: Adam      Created: Jul 14, 2009      Views: 2393 Tweet This Page  Post page to Facebook  Post page to Facebook

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




                                   Comparison Operators in PHP


Comment on Arithmetic Operators in PHP




Search Tags:
Arithmetic   ·  Operators   ·  in   ·  PHP   ·  
 
 
Arbitrary Links and Archives
Home
Active Forums
Members
SIte News
Link To Us
Gear
2009 Forum Archive
Programming Courses
Learn HTML
Learn CSS
Learn PHP
Learn MySQL
Learn Javascript
Learn jQuery
Learn ActionScript 3.0
Learn Java
Learn XML
DevelopPHP Requires Flash Player
Get Adobe Flash player
___________________________________________

Terms of Use  •  Privacy  •  Admin Notes

©2010 developphp.com   |   Powered By FlashBuildingHolder