Sat Sep 06, 2008 3:01 pm
<?
$x=5;
$y=$x;
?>
+ Addition 1 + 2
- Subtraction 4 - 2
* Multiplication 2 * 2
/ Division 20 / 4
% Modulus 7 % 3
<?php
$addition = 1 + 2;
$subtraction = 4 - 2;
$multiplication = 2 * 2;
$division = 20 / 4;
$modulus = 7 % 3;
echo "addition: 1 + 2= ".$addition."<br />";
echo "subtraction: 4 - 2 = ".$subtraction."<br />";
echo "multiplication: 2* 2 = ".$multiplication."<br />";
echo "division: 20 / 4 = ".$division."<br />";
echo "modulus: 7 % 3 = " . $modulus ;
addition: 1+ 2 = 3
subtraction: 4 - 2 = 2
multiplication: 2 * 2 = 4
division: 20 / 4 = 5
modulus: 7 % 3 = 1
$mstring1="Welcome to ";
$mstring2="Codemiles Forums";
echo $mstring1.$mstring2;
Welcome to Codemiles Forums
Operator English Example Equivalent Operation
+= Plus Equals $x += 1; $x = $x + 1;
-= Minus Equals $x -= 1; $x = $x - 1;
*= Multiply Equals $x *= 1; $x = $x * 1;
/= Divide Equals $x /= 1; $x = $x / 1;
%= Modulo Equals $x %= 1; $x = $x % 1;
.= Concatenate Equals $my_str.="codemiles"; $my_str = $my_str . "codemiles";
$value=10;
echo "my value is ".$x++;
echo "my value is ".$x;
$value=10;
echo "<br/>my value is ".$++x;
echo "my value is ".$x;
my value is 10 my value is 11
my value is 11 my value is 11
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.