×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: user23184
Added: Dec 29, 2016 3:29 PM
Modified: Dec 29, 2016 3:31 PM
Views: 15
Tags: no tags
  1.         <?php
  2.         $var1 = 3;
  3.         $var2 = 4;
  4.         ?>
  5.         Basic Math: <?php echo ((1 + 2 + $var1) * $var2) / 2 - 5; ?><br />
  6.         <br />
  7.         Absolute value: <?php echo abs(0 - 300); ?><br />
  8.         Exponential: <?php echo pow(2,8); ?><br />
  9.         Square root: <?php echo sqrt(100); ?><br />
  10.         Modulo: <?php echo fmod(20,7); ?><br />
  11.         Random: <?php echo rand(); ?><br />
  12.         Random (min,max): <?php echo rand(1,10); ?><br />
  13.         <br />    
  14.         += : <?php $var2 += 4; echo $var2; ?><br />
  15.         -= : <?php $var2 -= 4; echo $var2; ?><br />
  16.         *= : <?php $var2 *= 3; echo $var2; ?><br />
  17.         /= : <?php $var2 /= 4; echo $var2; ?><br />
  18.         <br />
  19.         Incrementing (add 1 to variable) : <?php $var2 ++; echo $var2; ?><br />
  20.         Decrementing (subtract 1 to variable) : <?php $var2 --; echo $var2; ?><br />
  21.         <br />
  22.         <?php
  23.             echo 1 + "2 houses";
  24.         ?>